Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What is causing this model to go flying across the map?

In my game players cannot collide with each other. The pets are also non-collide and reside inside the player character. They use a bodygyro and a bodyposition to follow the player's right lower leg. Here is the script that is inside each pet:

local Character = script.Parent.Parent
local Orb = script.Parent:WaitForChild("headPart")

local BodyPosition = Orb:WaitForChild("BodyPosition")
local BodyGyro = Orb:WaitForChild("BodyGyro")
BodyGyro.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
BodyPosition.MaxForce = Vector3.new(math.huge ,math.huge, math.huge)
 
while wait(0) do
	BodyPosition.Position = Character.Head.CFrame:pointToWorldSpace(Vector3.new(3, -3.5, 2))
	local X = Character.Head.CFrame.x
	local Z = Character.Head.CFrame.z
	BodyGyro.CFrame = CFrame.new(Orb.Position,Character:FindFirstChild("RightLowerLeg").Position)
	BodyGyro.CFrame = BodyGyro.CFrame * CFrame.Angles(0,5.5,0)
end

I've dragged the pet all around the map without issue, it doesn't get stuck on anything and nothing unexpected happens... until you get close to another player. Here is a gif that shows what happens: GIF Basically, when the pet gets close to another player character it occasionally goes flying across the map. It doesn't always happen, and sometimes it happens just by being in proximity to another player without touching them.

What's going on here?

2 comments

0

Line 6. Change maxTorque to MaxTorque

0

Updated Line 6, thanks! I didn't even notice it. The issue still persists, but at least the syntax is proper now.

1 answer

i dont think they should be math.huge

local BodyPosition = Orb:WaitForChild("BodyPosition")
local BodyGyro = Orb:WaitForChild("BodyGyro")
BodyGyro.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
BodyPosition.MaxForce = Vector3.new(math.huge ,math.huge, math.huge)

This discussion is preserved as it was. New answers, comments, and votes are closed.