So I've made this script:
script.Parent.Touched:connect(function(part) if part.Parent and game:GetService('Players'):GetPlayerFromCharacter(part.Parent) then local player = game:GetService('Players'):GetPlayerFromCharacter(part.Parent) if player:GetRankInGroup(3200799) < 300 then local humanoid = part.Parent:FindFirstChild("Humanoid") humanoid.Health = 0 end end end)
but I want the player to respawn instantly, how do I do that?
You can use the function LoadCharacter to force the player to respawn.
local plrServ = game:GetService('Players') script.Parent.Touched:connect(function(hit) local plr = plrServ:GetPlayerFromCharacter(hit.Parent) if plr and plr:GetRankInGroup(3200799) < 300 then plr:LoadCharacter() end end)
I hope this helps