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

This script broke can someone please help me?

So it is a sleep tool it suppose to make you sleep but it doesn't make you fall anymore really does nothing. Can someone please fix it?

Script:

gyro = Instance.new("BodyGyro")
gyro.maxTorque = Vector3.new(4e+004,0,0)
gyro.cframe = CFrame.fromAxisAngle(Vector3.new(0,0,1),math.pi/2)

function onButton1Down(mouse)

local player = game.Players.LocalPlayer
if player == nil then return end

if player.Character.Torso:findFirstChild("BodyGyro") ~= nil then
player.Character.Torso:findFirstChild("BodyGyro"):remove()
else
gyro:clone().Parent = player.Character.Torso
end

mouse.Icon = "rbxasset://textures\\ArrowCursor.png"

end

function onSelected(mouse)
mouse.Icon = "rbxasset://textures\\ArrowCursor.png"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end

bin.Selected:connect(onSelected)

1 answer

Maybe LocalPlayer is your error.

gyro = Instance.new("BodyGyro")
gyro.maxTorque = Vector3.new(4e+004,0,0)
gyro.cframe = CFrame.fromAxisAngle(Vector3.new(0,0,1),math.pi/2)

function onButton1Down(mouse)

local player = script.Parent.Parent.Parent
if player == nil then return end

if player.Character.Torso:findFirstChild("BodyGyro") ~= nil then
player.Character.Torso:findFirstChild("BodyGyro"):remove()
else
gyro:clone().Parent = player.Character.Torso
end

mouse.Icon = "rbxasset://textures\\ArrowCursor.png"

end

function onSelected(mouse)
mouse.Icon = "rbxasset://textures\\ArrowCursor.png"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end

bin.Selected:connect(onSelected)

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