I have a floating pet system, i got it from a tutorial, and edited it a bit to improve it, and optimize it more, here is the script:
if Player then
local Char = Player.Character
if Char then
local HRP = Char.HumanoidRootPart
local CPet = Pet:Clone()
CPet.Parent = Char
local BPos = Instance.new("BodyPosition")
BPos.Parent = CPet
BPos.D = 1500
BPos.P = 10000
BPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
local BGyro = Instance.new("BodyGyro")
BGyro.Parent = CPet
BGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
CPet.CanCollide = false
CPet.Massless = true
while true do
wait(0.3)
local MoveToPos = (HRP.CFrame * CFrame.new(-2, -1, 0)).p
BPos.Position = MoveToPos
BGyro.CFrame = HRP.CFrame
end
end
end
Well, i want to know if there’s a way to improve it more, because i don’t feel satisfied with the whole code, i think there’s a better way to do this or improve it, thanks for reading.