Hasli4

RBLX. TouchScript

May 15th, 2025 (edited)
577
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. local RESPAWN_DURATION = 3
  2.  
  3. local Players = game:GetService("Players")
  4. local ServerStorage = game:GetService("ServerStorage")
  5.  
  6.  
  7. local function onTouched(other)
  8.     if other.Name == "HumanoidRootPart" or other.Name == "Cannon" then
  9.         local playerName = tostring(other.Parent)
  10.         local player = Players[playerName]
  11.        
  12.         local enemyStat = player.leaderstats:WaitForChild("Score")
  13.         local looseStat = player.leaderstats:WaitForChild("Loose")
  14.         looseStat.Value += 1
  15.         --print(playerName, player, looseStat.Value, enemyStat.Value)      
  16.         enemyStat.Value = 0
  17.        
  18.         -- убираем игрока в ReplicatedStorage
  19.         local character = other.Parent
  20.         character.Parent = game:GetService("ReplicatedStorage")
  21.        
  22.         local explosion = Instance.new("Explosion", workspace)
  23.         explosion.Position = character:GetPrimaryPartCFrame().p
  24.        
  25.         -- Ждём три секунды
  26.         wait(RESPAWN_DURATION)
  27.         -- Возвращаем игрока обратно
  28.         character.Parent = workspace
  29.         character.HumanoidRootPart.Velocity = Vector3.new(0,0,0)
  30.         character.HumanoidRootPart.VectorForce.Force = Vector3.new(0,0,0)
  31.        
  32.     end
  33. end
  34.  
  35. script.Parent.Touched:Connect(onTouched)
  36.  
Advertisement
Add Comment
Please, Sign In to add comment