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

How can I make the player go to Lobby instead off falling out off the map and dying?


--I used the solution from 6 Years ago. But it seems not to work anymore. Please help

--The part where it meant to take the player to the map.

	choosemap:Destroy()
	for _,plr in pairs(game.Players:GetChildren()) do
		if plr.Backpack:FindFirstChild("Sword") then
			plr.Backpack.Sword:Destroy()
		if plr.Backpack:FindFirstChild("Handgun") 	
			then plr.Backpack.Handgun:Destroy()
				for i,v in pairs(game.Players:GetPlayers()) do
					v.Character:MoveTo(Vector3.new(game.Workspace.Spawns))
				end
			end
		end
	end

end

6 comments

0

Do you have a video of what's happening? What does the output log say?

0

I don't sorry. But It just wouldn't TP player like it would destroy map.

0

Without the output log I can't say anything conclusively. Maybe it's because some players don't have characters when the map is destroyed so the script shows an error?

0

It says this :   14:59:50.565 Loading Cutscene Editor... - Studio   14:59:51.231 Infinite yield possible on 'ServerScriptService:WaitForChild("Humanoid")' - Studio   14:59:51.232 Stack Begin - Studio   14:59:51.232 Script 'ServerScriptService.Fall+Rag Death', Line 98 - Studio - Fall+Rag Death:98   14:59:51.232 Stack End - Studio   14:59:55.683 Loading Cuts

0

Also, theres no error in the script.

0

@radiant_Light203

2 answers

✓ Accepted answer

There should be an end after line 08. Because in your script, it seems you used two if's without ending the first one.

--I used the solution from 6 Years ago. But it seems not to work anymore. Please help

--The part where it meant to take the player to the map.

    choosemap:Destroy()
    for _,plr in pairs(game.Players:GetChildren()) do
        if plr.Backpack:FindFirstChild("Sword") then
            plr.Backpack.Sword:Destroy()
		end -- here!
        if plr.Backpack:FindFirstChild("Handgun")   
            then plr.Backpack.Handgun:Destroy()
                for i,v in pairs(game.Players:GetPlayers()) do
                    v.Character:MoveTo(Vector3.new(game.Workspace.Spawns))
                end
            end
        end
    end

end

2 comments

0

OOOOOOOOOH

0

I got rid of the "if" for handgun and added the end there. So would that work???"

Put a part and name it Tele2:

function onTouch(part)
if part.Parent.Humanoid ~=nil then
part.Parent:MoveTo(script.Parent.Parent.Tele1.Position)
script.Parent.Parent.Tele1.Script.Disabled = true 
wait(2)
script.Parent.Parent.Tele1.Script.Disabled = false
end
end
script.Parent.Touched:connect(onTouch)

then create another and name it Tele1:

function onTouch(part)
if part.Parent.Humanoid ~=nil then
part.Parent:MoveTo(script.Parent.Parent.Tele2.Position)
script.Parent.Parent.Tele2.Script.Disabled = true 
wait(2)
script.Parent.Parent.Tele2.Script.Disabled = false
end
end
script.Parent.Touched:connect(onTouch)	

add your giver scripts and why is there a beginning indent

    choosemap:Destroy()
    for _,plr in pairs(game.Players:GetChildren()) do

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