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

How to make it work?

Asked by 9 years ago

I want that if a player joins and his name is rinus17 , He'll get some tools in his backpack automaticly
This is a script which is in workspace.

Player = game.Players.LocalPlayer

function Added(Player)
    if Player.Name == "rinus17" then
        game.Lighting.Emi:clone().Parent = Player.BackPack
    end
end

game.Players.PlayerAdded:conncet(Added)
0
what isnt working? NinjoOnline 1146 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago
function Added(Player)
    if Player.Name == "rinus17" then
        local emi = game.Lighting:WaitForChild("Emi")
    emi:Clone().Parent = Player:WaitForChild("Backpack")
    emi:Clone().Parent = Player:WaitForChild("StarterGear")
    end
end

game.Players.PlayerAdded:conncet(Added)
  1. Problem is you had the localplayer which you didnt need.
  2. Just make sure this is in a normal script and inside either Workspace or ServerScriptStorage.
  3. Make sure that the Emi is inside Lighting.
  4. Other than that you should be good.

Hope this helped and please +1 and accept answer.

  • NinjoOnline
0
It tells me that Backpack isn't a valid member of Player brokenrares 48 — 9y
0
EDIT, I editted. Try now and it should work NinjoOnline 1146 — 9y
0
Thanks a lot. brokenrares 48 — 9y
0
Question, if I want the player to spawn with the tools after he respawns too, do I have to delete the function and add Player = game.Players.LocalPlayer? brokenrares 48 — 9y
0
no, I have re-editted my script, so that way when they die they will still have those tools on them NinjoOnline 1146 — 9y
Ad

Answer this question