I made a script where when you click a button, a pet will come out and follow you, and I made it that more than one pet can follow, but the result I got is a disaster. Because when I click the button again the pet spawn in the same place as the other pet, and it all squeeze/stack together and look like a monster. How can I make it that each spawn and follow you in a different position?
Example:
https://cdn.discordapp.com/attachments/456967793397727233/485850971281555477/unknown.png
here is the script, it is a local script
local char = script.Parent.Parent local hum = char:FindFirstChild("Humanoid") local head = char:FindFirstChild("Head") local pet = script.Parent local maxFloat = 1 local floatInc = 0.025 local sw = false local fl = 0 while true do wait() if not sw then fl = fl + floatInc if fl >= maxFloat then sw = true end else fl = fl - floatInc if fl <=-maxFloat then sw = false end end if pet ~= nil and hum ~= nil and head ~= nil then if hum.Health >= 0 then local cf = head.CFrame * CFrame.new(3,2+fl,3) pet.BodyPosition.Position = Vector3.new(cf.x,cf.y,cf.z) pet.BodyGyro.CFrame = head.CFrame * CFrame.new(3,0,-3) else break end end end