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

Character respawns when it isn't supposed to?

I tried making a hopperbin that takes control of [almost] anything that has a humanoid in it. Works the way it should in studio, but it respawns my character in the actual game, which it shouldn't. Could someone please figure this out?

player = game.Players.LocalPlayer
repeat wait() until player.Character
bin = script.Parent

function assumeControl(character)
	local cframe = character.Torso.CFrame
	character.Torso.CFrame = CFrame.new(cframe.x, cframe.y+(1/10^3), cframe.x)
	
	--Unanchoring
	for _, v in pairs(character:GetChildren()) do
		if v:IsA("BasePart") and v.Anchored then v.Anchored = false
		elseif v:IsA("Hat") and v.Handle.Anchored then v.Handle.Anchored = false
		elseif v:IsA("Tool") then
			for _, v2 in pairs(v:GetChildren()) do
				if v:IsA("BasePart") and v.Anchored then v.Anchored = false end
			end
		end
	
	player.Character = character
	workspace.CurrentCamera.CameraSubject = character.Humanoid
	end
end

function onButton1Down(mouse)
	local mt = mouse.Target
	if mt and mt.Parent:FindFirstChild("Humanoid") then
		assumeControl(mt.Parent)
		
	elseif mt and mt.Parent:IsA("Hat") then
	local x = mt
	repeat x = x.Parent until x.Parent == workspace
	local human = x:FindFirstChild("Humanoid", true)
	if human then assumeControl(human.Parent) end
	
	end
end

function onSelected(mouse)
	mouse.Button1Down:connect(function()onButton1Down(mouse) end)
end

bin.Selected:connect(onSelected)

1 answer

Set the AutoRespawn to off (Located under Players as a Property). This will allow for you to not be respawned, all you need to do now is make a system to automatically respawn people.

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