Really needing help on this lol, every time I use player added something gets messed up. The script only works when the player first joins and doesn't work if they reset! Can somebody fix this?
game.Players.PlayerAdded:connect(function(player)
while not player.Character do wait() end
local Ch=player.Character
local g = script.Arm2:clone()
g.Parent = Ch
local C = g:GetChildren()
for i=1, #C do
if C[i].className == "Part" then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
end
local Y = Instance.new("Weld")
Y.Part0 = Ch["Right Arm"]
Y.Part1 = g.Middle
Y.C0 = CFrame.new(0, 0, 0)
Y.Parent = Y.Part0
end
local h = g:GetChildren()
for i = 1, # h do
if h[i].className == "Part" then
h[i].Anchored = false
h[i].CanCollide = false
end
end
end)

4 comments
Yeah but this doesn't fix his issue with the script only be called once. Take all that code and put it into a seperate function, called by the event.
Why not use the Generic For instead of iterating like the above? Also, why use 'ClassName' to compare object types? Imo, that gets repetitive, b/c you're repeating typing that, while you can use 'IsA', which uses less typing, and all the flaws w/ the 'ClassName' comparison(ing) is very little to occur w/ it.
King of helping me w all my errors, it actually works Thanks SM!
This really helps because now I can fix the rest of my scripts that had the same error