- Why is there wait? You don't need one in this case.
- Why are you calling a function and then letting an event call the function?
- TeamColor is a BrickColor
- The Score script... Look up leaderboard in the wiki...
Wait
The wait is for when you are doing a PlayerAdded type event in a local script. You can't do player added in a local script. You can reach the player through LocalPlayer, but the script runs before the player joins. So that's why the wait is there.
FR
Why are you calling the function and then calling it again with an event? Why are you using a Changed event? You can see if a player died using the Died event.
1 | workspace.Player.Humanoid.Died:connect() |
2 | print ( "A person died!" ) |
we can see who killed a player by using tags.
1 | workspace.Player.Humanoid.Died:connect() |
2 | if workspace.Player.Humanoid:FindFirstChild( "Tag" ) then |
3 | print ( "Player was Killed by " ..workspace.Player.Humanoid.Tag.Value.Name.. "!" ) |
5 | print ( "A person died!" ) |
To insert a tag, make an object value. The value of the object value will be the player who is trying to kill the other player.
03 | if not humanoid:FindFirstChild( "tag" ) then |
04 | local tag = Instance.new( "ObjectValue" , humanoid) |
06 | tag.Value = game:GetService( "Players" ):GetPlayerFromCharacter(script.Parent.Parent.Parent) |
12 | script.Parent.Touched:connect( function (char) |
13 | if char:FindFirstChild( "Humanoid" ) then |
TeamColor is a BrickColor
A TeamColor is a BrickColor! So instead of TeamColor == ("Bright red")
try
1 | if game:GetService( "Players" ).LocalPlayer.TeamColor = = BrickColor.new( "Bright red" ) then |
Leaderboard
Look here.
Here is a better version of your script. This isn't the whole thing, I'm just making the script work.
3 | if game.Players.LocalPlayer.TeamColor = = BrickColor.new( "Bright red" ) then |
4 | game.Teams.Atlas.Score = game.Teams.Atlas.Score+ 1 |
5 | script.Parent.Text = game.Teams.Atlas.Score |
9 | game.Players.LocalPlayer.Character.Humanoid.Died:connect(FR) |
Hope this helps!