I put this code in a LocalScript, and it'll run the script once the player touches the Brick with the script in it. Wheres my problem? I'm new to scripting...
local character = game.Players.LocalPlayer.Character script.Parent.Touched:connect(function() if character.Humanoid.WalkSpeed == 16 then character.Humanoid.WalkSpeed = 20 else character.Humanoid.WalkSpeed = 20 end end)
Accessing LocalPlayer
is for when the script is running on that player's computer, inside things like GUIs and tools. In a server script, it doesn't mean anything in particular. Instead, you would need to get the character from the part which touched the object, like this:
script.Parent.Touched:connect(function(hit) local character=hit.Parent if character:FindFirstChild("Humanoid")then if character.Humanoid.WalkSpeed==16 then character.Humanoid.WalkSpeed=20 end end end)