Answered by
iaz3 190
10 years ago
Use brackets to access a name directly that has spaces, shown below.
1 | game.Workspace.p.Character [ "Right Leg" ] :Destroy() |
Also, you script has several minor errors.
Your script runs when the player is added, and it runs PlayerJoined. When this happens, it passes the player itself to your function.
"p" in your function is the player, so you do not need to go game.Workspace.p.Character
Also, players in a game are stored in game.Players
the characters are in Workspace
Your code should then be as follows
1 | function PlayerJoined(p) |
2 | p.Character [ "Right Leg" ] :Destroy() |
4 | game.Players.PlayerAdded:connect(PlayerJoined) |
I would also add a check to make sure the character exists, just in case.
1 | function PlayerJoined(p) |
2 | repeat wait() until p.Character |
3 | p.Character [ "Right Leg" ] :Destroy() |
5 | game.Players.PlayerAdded:connect(PlayerJoined) |