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

CharacterAdded script not working, does anybody knows how to fix?

Asked by 9 years ago

So I am trying to make a script that when you join it gives you the body parts I put into ServerStorage, I tried the script and it doesn't works, I am not sure what is the error, because there's no output that shows any mistakes, heres the entire code:

print "Script succesfully loaded"
local noob = game.Workspace:FindFirstChild("Humanoid")
local LeftA = game.ServerStorage.LeftArm:Clone()
local LeftL = game.ServerStorage.LeftLeg:Clone()
local RightA = game.ServerStorage.RightArm:Clone()
local RightL = game.ServerStorage.RightLeg:Clone()
local Tor = game.ServerStorage.Torso:Clone()

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        wait(30)
        Tor.Parent = noob
        RightL.Parent  = noob
        RightA.Parent = noob
        LeftL.Parent = noob
        LeftA.Parent = noob
    end)
end)
0
Change the title, there is no ChildAdded event. EzraNehemiah_TF2 3552 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

The problem is, FindFirstChild, finds the FIRST child with the name of Humanoid, there is more people in the game also which means there could be up to 5 humanoids, so it didn't work since it's targeted to only finding 1 humanoid. So try this:

print"Script succesfully loaded"
local LeftA = game.ServerStorage.LeftArm:Clone()
local LeftL = game.ServerStorage.LeftLeg:Clone()
local RightA = game.ServerStorage.RightArm:Clone()
local RightL = game.ServerStorage.RightLeg:Clone()
local Tor = game.ServerStorage.Torso:Clone()

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        wait(30)
        Tor.Parent = character
        RightL.Parent  = character
        RightA.Parent = character
        LeftL.Parent = character
        LeftA.Parent = character
    end)
end)

If you want to make the parts go into the humanoid, replace character with character.Humanoid,


Hope it helps! Tell me if it doesn't work.

0
Nice answer, bro! DewnOracle 115 — 9y
0
It does! Thanks! biocommand 30 — 9y
Ad

Answer this question