Hello, developers!
I have made a wonderful pet sending system, where you click on a part, and it will send the pet to it. The problem is, it doesn’t seem to work, without errors! Here’s the code, any help is appreciated!:
local function sendToPile(Pet)
local Part = script.Parent.Parent.Parent.PetPart
local RootPart = Pet:WaitForChild("RootPart")
local TweenService = game:GetService("TweenService")
local Tween = TweenService:Create(RootPart, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0), {CFrame = Part.CFrame})
end
script.Parent.MouseClick:Connect(function(PlayerWhoClicked)
local PetsFolder = PlayerWhoClicked.Character:FindFirstChild("Pets")
local EquippedPet
if not PetsFolder or PetsFolder:GetChildren() == nil then return end
for Index, Pet in ipairs(PetsFolder:GetChildren()) do
if Pet:FindFirstChild("Equipped") == true then
EquippedPet = Pet
break
else
continue
end
end
sendToPile(EquippedPet)
end)
Thanks in advance!