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

i made this thing but how would i make it work with players? do i do player.name?

Code:

function Click()
	
game.Workspace.Player.Name.Tors.Waist.Seat.Disabled = true

wait(1)

game.Workspace.Player.Name.Tors.Waist.Seat.Disabled = false

end

script.Parent.MouseButton1Down:connect(Click)

1 comment

0

help pls...

1 answer

✓ Accepted answer

Improvements

Use Connect since connect is deprecated

Use Activated since it will work for all devices and not just computers

Use WaitForChild() to make sure an instance exists before using it

Issues

When you use Player.Name the way you have it written is that the "Tors" is parented under the player's Name property, which is impossible

Assuming you are attempting to locate the player in the workspace, use the player's Character instance instead

If this is in a GuiObject, the script should be a LocalScript and not a ServerScript

Revised Local Script

local player = game:GetService("Players").LocalPlayer
local button = script.Parent

button.Activated:Connect(function()
	local char = player.Character
	local seat = char:WaitForChild("Tors"):WaitForChild("Waist"):WaitForChild("Seat")

	seat.Disabled = true
	wait(1)
	seat.Disabled = false
end)

1 comment

0

Thanks! Sorry this is my first script ever

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