Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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?

0
Line 6. Change maxTorque to MaxTorque User#19524 175 — 5y
0
Updated Line 6, thanks! I didn't even notice it. The issue still persists, but at least the syntax is proper now. Buggims 4 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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)
Ad

Answer this question