Простой способ добавления питомца в Roblox Studio
#питомцыроблокс #роблокскоды #роблокс
-- Pet Script --
local RS = game:GetService("ReplicatedStorage")
local pet = RS.Pet -- здесь укажите имя вашего питомца
local click_detector = script.Parent.ClickDetector
local function givePet (player)
if player then
local character = player.Character
local Oldpet = character:FindFirstChild("Cat")
if (character) and (Oldpet == nil) then
local humRootPart = character.HumanoidRootPart
local newPet = pet:Clone ()
newPet.Parent = character
newPet.Anchored = false
local bodyPos = Instance.new("BodyPosition", newPet)
bodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
local bodyGyro = Instance.new("BodyGyro", newPet)
bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
while wait() do
bodyGyro.CFrame = humRootPart.CFrame* CFrame.fromEulerAnglesXYZ(0,math.pi-0.1,0)
bodyPos.Position = humRootPart.Position + humRootPart.CFrame.lookVector*-3 + humRootPart.CFrame.upVector*-1 + humRootPart.CFrame.rightVector*3
end
end
end
end
click_detector.MouseClick:connect(function(player)
givePet(player)
end)