Pretty much the question explains everything
Script:
01 | script.Parent.Touched:connect( function (hit) |
02 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
03 | local Victories = player.leaderstats.Victories |
04 | local human = hit.Parent:FindFirstChild( "Humanoid" ) |
05 | if human.Sit then |
06 | local sound = Instance.new( "Sound" ,game.Workspace.Objects.Sounds) |
07 | sound.SoundId = "rbxasset://sounds/victory.wav" |
08 | sound.MaxDistance = 10.000 |
09 | sound:Play() |
10 | Victories.Value = Victories.Value + 1 |
11 | human.Sit = false |
12 | wait( 2 ) |
13 | sound:Destroy() |
14 | end |
15 | end ) |
01 | script.Parent.Touched:connect( function (hit) |
02 | if hit.Parent:FindFirstChild( "Humanoid" ) then --< You need to check it it's an actual player that is touching the part. |
03 |
04 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
05 | local Victories = player.leaderstats.Victories |
06 | local human = hit.Parent:FindFirstChild( "Humanoid" ) |
07 | if human.Sit then |
08 | local sound = Instance.new( "Sound" ,game.Workspace.Objects.Sounds) |
09 | sound.SoundId = "rbxasset://sounds/victory.wav" |
10 | sound.MaxDistance = 10.000 |
11 | sound:Play() |
12 | Victories.Value = Victories.Value + 1 |
13 | human.Sit = false |
14 | wait( 2 ) |
15 | sound:Destroy() |
16 | end |
17 | end |
18 | end ) |