Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to know if a user attempted to use Menu>Respawn?

Asked by
Nickoakz 231 Moderation Voter
10 years ago

I have a friend who wants to block Menu Respawning and also alert the user that your requested respawn has been rejected, and the game controls respawning only.

I have the script working great, renaming Humanoid to humanoid, and loading custom Health and Animations to fix re spawning and animation with the new humanoid name, but if I try adding another Humanoid to the character and do a Menu Respawn, it kills the character.

Is there a way to prevent killing the player, and being able to know if the player attempted to manually respawn?

coroutine.resume(coroutine.create(function()
    chr:WaitForChild("Humanoid")
    chr.Humanoid.Name="humanoid"
    while chr:findFirstChild("Health") == nil and wait() do end 
    chr.Health:Destroy()
    while chr:findFirstChild("Animate") == nil and wait() do end 
    chr.Animate:Destroy()
    local rep=script.Health:Clone()
    rep.Parent=chr
    rep.Disabled=false
    local rep=script.Animate:Clone()
    rep.Parent=chr
    rep.Disabled=false
    for a,obj in pairs(chr:children()) do 
        if obj:IsA("CharacterMesh") and obj.Name:find("3.0") then 
            obj:Destroy() 
        end 
    end 
    local hum=Instance.new("Humanoid",chr)
    while wait() do
        if hum.Health==0 then
            print("DENIED")
            hum.Health=100
        end
    end 
end))

Other needed tags: Humanoid, Death Unable to find an appropriate tag!! Edit: Found better tags.

1
If you mean resetting, I need to know this too. Tortelloni 315 — 10y

1 answer

Log in to vote
1
Answered by 10 years ago

This method will work if your game doesn't involve killing:

function newPlayer(p)
local pos = CFrame.new(0, 4, 0) -- Set this to the origianal spawn location
p.CharacterAdded:connect(function(c)
c.Torso.CFrame = pos
c:WaitForChild("Humanoid").Died:connect(function()
pos = c.Torso.CFrame
p:LoadCharacter()
end)
end)
end)
0
This is a nasty alternative but it does work incase the person has to re spawn because its stuck to a seat or so. Nickoakz 231 — 10y
0
It was glitching most of my scripts, but you can try agian. Nickoakz 231 — 10y
Ad

Answer this question