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

How can I fix this?

Asked by 8 years ago

This is an extremely simple script and for some reason I am not able to figure out how to fix this.It doesn't work in studio solo mode where I'm testing it.Please help.

a=game.Workspace:FindFirstChild('Player1')

function alba()
a:FindFirstChild('Humanoid').WalkSpeed=12
end 

alba()

2 answers

Log in to vote
1
Answered by 8 years ago
repeat wait() until game.Workspace:FindFirstChild('Player1')
a=game.Workspace:FindFirstChild('Player1')

function alba()
a:FindFirstChild('Humanoid').WalkSpeed=12
end 

alba()

The problem with finding a character in Workspace is the script starts working before the character spawns in Workspace. So the problem with this script is that it immediatly attempts to find Player1 in workspace, which it won't. So, if we add a wait loop, it will keep delaying the script until Player1 is found in Workspace, then it will carry out the script.

Ad
Log in to vote
0
Answered by
xuefei123 214 Moderation Voter
8 years ago

Is your name actually Player1 or something else? And same with humanoid is it same as "Humanoid"

0
When you test in studio the player name is "Player1",its default for everyone. alphaboy299 15 — 8y

Answer this question