Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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 comment

1

If you mean resetting, I need to know this too.

1 answer

✓ Accepted answer

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)

2 comments

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.

0

It was glitching most of my scripts, but you can try agian.

This discussion is preserved as it was. New answers, comments, and votes are closed.