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

what wrong with this script?

Asked by 9 years ago

Hi I was trying to make when a player joins they get a sword. But this doesn't work. Can you help?

local sword = game:GetService("ServerStorage").ClassicSword:clone()

game:GetService("Players").PlayerAdded:connect(function(plyr)
  sword.Parent = plyr.StarterGear
  sword:clone().Parent = plyr.BackPack
end)
0
I am not sure, I dont want to test the script in a place, but sword:clone().Parent? I dont think you can use parentheses in a heirarchy string yogipanda123 120 — 9y
0
@yogi That is not the case. 1waffle1 2908 — 9y

1 answer

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
9 years ago

If you are running this offline then it is possible that your character loads before the script loads, which would result in PlayerAdded never firing. This should otherwise work online.

0
Well the output says StaterGear is not a valid member of player... docrobloxman52 407 — 9y
0
You should have said that then. Replace that with plyr:WaitForChild("StarterGear") 1waffle1 2908 — 9y
0
thanks man docrobloxman52 407 — 9y
Ad

Answer this question