Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RESPAWN_DURATION = 3
- local Players = game:GetService("Players")
- local ServerStorage = game:GetService("ServerStorage")
- local function onTouched(other)
- if other.Name == "HumanoidRootPart" or other.Name == "Cannon" then
- local playerName = tostring(other.Parent)
- local player = Players[playerName]
- local enemyStat = player.leaderstats:WaitForChild("Score")
- local looseStat = player.leaderstats:WaitForChild("Loose")
- looseStat.Value += 1
- --print(playerName, player, looseStat.Value, enemyStat.Value)
- enemyStat.Value = 0
- -- убираем игрока в ReplicatedStorage
- local character = other.Parent
- character.Parent = game:GetService("ReplicatedStorage")
- local explosion = Instance.new("Explosion", workspace)
- explosion.Position = character:GetPrimaryPartCFrame().p
- -- Ждём три секунды
- wait(RESPAWN_DURATION)
- -- Возвращаем игрока обратно
- character.Parent = workspace
- character.HumanoidRootPart.Velocity = Vector3.new(0,0,0)
- character.HumanoidRootPart.VectorForce.Force = Vector3.new(0,0,0)
- end
- end
- script.Parent.Touched:Connect(onTouched)
Advertisement
Add Comment
Please, Sign In to add comment