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

Will this script even work, and whats the problem with it?

I tried to make a running script ,but when i tried to test it it says "attempt to index local 'Player' (a nil value) on the line 2".

local Player = game.Players.LocalPlayer
local Character = Player.Character
local Human = game.Players.LocalPlayer.Character

game:GetService("UserInputService").InputBegan:connect(function(input, gameprocesed)
	if input.KeyDown == Enum.KeyCode.LeftShift then
	   for i = 1,16 do 
			Human:WaitForChild("Humanoid").WalkSpeed = 30
		end
	end
end)

game:GetService("UserInputService").Input.Ended:connect(function(input, gameprocesed)
	if input.KeyDown == Enum.KeyCode.LeftShift then
		for i = 1,16 do
			Human:WaitForChild("Humanoid").WalkSpeed = 16
		end
	end
end)

3 comments

0

is this a serverscript?

0

no its a normal script, should i set it to localscript?

0

Set it to a LocalScript. Also, you shouldn't be using "for i" in this script.

1 answer

Set it as a local script and put it in StarterCharacterScripts, this is your problem. Nobody can use it without it being a startercharacterscripts. DM me if this doesn't work, Aurlius #1780 If that does not work, DM me from the ScriptingHelpers discord by looking up @Aurlius. Thanks.

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