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

Person cannot move when joined?

Asked by
FiredDusk 1466 Moderation Voter
9 years ago

This is in a local script and this does not keep the player still when they join.

01function onEntered()
02    h=script.Parent.Parent.Parent.Parent.Character
03    ll=h:FindFirstChild("Left Leg")
04    ra=h:FindFirstChild("Right Arm")
05    rl=h:FindFirstChild("Right Leg")
06    la=h:FindFirstChild("Left Arm")
07    he=h.Head
08    if (h.Torso.Anchored==false) then
09    h.Torso.Anchored=true
10    ll.Anchored=true
11    he.Anchored=true
12    ra.Anchored=true
13    la.Anchored=true
14    rl.Anchored=true
15    h.Humanoid.WalkSpeed=0
16    end
17end
2
The problem might be the script fire to fast which basically means that the script runs before the Players character have loaded into the game. UserOnly20Characters 890 — 9y

2 answers

Log in to vote
1
Answered by 9 years ago
1game.Players.PlayerAdded:connect(function(Player)
2    Player.CharacterAdded:connect(function(Char)
3    for _,v in pairs (Char:GetChildren()) do
4if v:IsA("Part") then
5    v.Anchored = true
6end
7    end
8    end)
9end)
Ad
Log in to vote
2
Answered by
iSvenDerp 233 Moderation Voter
9 years ago

Hi...Not sure what ur asking for me to figure out but i think u want to make a players walkspeed different.

1game.Players.PlayerAdded:connect(function(player) -- We r using the PlayerAdded Function
2    player.CharacterAdded:connect(function(character) -- Were fixing to get into the juicy stuff.
3        local hum = character:WaitForChild("Humanoid") -- We have called the humanoid and named it hum.
4 
5        hum.Walkspeed = 100 -- This makes the players walkspeed 100
6 
7    end)
8end)

Hope This Helped Let me know if it did or didnt i can change it if it didnt:)

Answer this question