Advertisement
Cakey3101

Lava Handler - EP 2!

Apr 16th, 2025
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | Source Code | 0 0
  1. local Players = game:GetService("Players") -- Getting The Players Service
  2.  
  3. for _, child in script.Parent:GetChildren() do -- Looping Through All The Children In The Folder
  4.     if child.Name == "Lava" then
  5.         child.Touched:Connect(function(OtherPart: BasePart) -- Listening To When It Is Touched
  6.             local Character = OtherPart.Parent -- Getting The Character
  7.             local Player = Players:GetPlayerFromCharacter(Character) -- Getting The Player
  8.            
  9.             if Player then
  10.                 Character:PivotTo(script.Parent.Parent.SpawnLocation.CFrame) -- Respawning Them
  11.                 script.Parent.Sound:Play() -- Playing The Sound
  12.                 Player.leaderstats.Deaths.Value += 1 -- Increasing Their Deaths
  13.                 script.Enabled = false
  14.                 task.wait(2)
  15.                 script.Enabled = true
  16.             end
  17.         end)
  18.     end
  19. end
Tags: robloxstudio
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement