Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players") -- Getting The Players Service
- for _, child in script.Parent:GetChildren() do -- Looping Through All The Children In The Folder
- if child.Name == "Lava" then
- child.Touched:Connect(function(OtherPart: BasePart) -- Listening To When It Is Touched
- local Character = OtherPart.Parent -- Getting The Character
- local Player = Players:GetPlayerFromCharacter(Character) -- Getting The Player
- if Player then
- Character:PivotTo(script.Parent.Parent.SpawnLocation.CFrame) -- Respawning Them
- script.Parent.Sound:Play() -- Playing The Sound
- Player.leaderstats.Deaths.Value += 1 -- Increasing Their Deaths
- script.Enabled = false
- task.wait(2)
- script.Enabled = true
- end
- end)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement