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

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

Asked by 5 years ago

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".

01local Player = game.Players.LocalPlayer
02local Character = Player.Character
03local Human = game.Players.LocalPlayer.Character
04 
05game:GetService("UserInputService").InputBegan:connect(function(input, gameprocesed)
06    if input.KeyDown == Enum.KeyCode.LeftShift then
07       for i = 1,16 do
08            Human:WaitForChild("Humanoid").WalkSpeed = 30
09        end
10    end
11end)
12 
13game:GetService("UserInputService").Input.Ended:connect(function(input, gameprocesed)
14    if input.KeyDown == Enum.KeyCode.LeftShift then
15        for i = 1,16 do
16            Human:WaitForChild("Humanoid").WalkSpeed = 16
17        end
18    end
19end)
0
is this a serverscript? Elixcore 1337 — 5y
0
no its a normal script, should i set it to localscript? TheAkiSa 7 — 5y
0
Set it to a LocalScript. Also, you shouldn't be using "for i" in this script. sngnn 274 — 5y

1 answer

Log in to vote
-1
Answered by 5 years ago

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.

Ad

Answer this question