Answered by
5 years ago Edited 5 years ago
1 You don't need an "if" at the start.
2 Its game.Players and to see if they were added its PlayerAdded.
3 I would also recommend to delete the shirt or replace the id if they have one or make one if the player has no shirt and put the id in it so if they don't have a shirt on, they would still have the shirt.
4 Also, the shirt is not in the humanoid and Player ~= to the character. If you want to get the character you would need to do plr.Character .
5 And when you put in the function (plr), it gives you the player that joined but in the script you use "Player" which is ~= plr unless its in a localscript and you did game.Players.LocalPlayer but still, idk why you would put (plr) if you don't need it and same thing with the function.
1 | if Player.Players.Added:Connect( function (plr) |
2 | if Player.GlassPTCase.Collided = true then |
3 | Player.Humanoid.Shirt = |
If you do all these changes the script will look like this.
1 | game.Players.PlayerAdded:Connect( function (plr) |
2 | if plr.GlassPTCase.Collided = true then |
But honestly, I don't know what that script is really supposed to do but I am sure it would still not work. If you want to know if someone touched the part you would use .Touched and not "Collided?".
If I had to do it, this is how it would look like:
01 | local part = script.Parent |
04 | part.Touched:Connect( function (Hit) |
05 | local Find = Hit.Parent:FindFirstChild( "Humanoid" ) or Hit.Parent.Parent:FindFirstChild( "Humanoid" ) |
07 | local shirt = Find.Parent:FindFirstChildOfClass( "Shirt" ) |
09 | Instance.new( "Shirt" , Find.Parent) |
11 | Hit.Parent.Shirt.ShirtTemplate = id |
That way, when you touch the part, its looking if a shirt exists, if not then it creates one and then it changes the id of the shirt.