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

The player keeps falling out of the map when its destroyed :/ ?

Asked by 3 years ago

Hello. The player keeps falling out of the map and I tried the last 2 solutions on the last But didn't So can someone please help.

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()
            end -- here!    
                for i,v in pairs(game.Players:GetPlayers()) do
                    v.Character:MoveTo(Vector3.new(game.Workspace.Spawns))
                end
            end
        end
    end
0
You need to iterate through Spawns and give their Vector3 Position. I recommend you use SetPrimaryPartCFrame however, as MoveTo applies Vectors which factor collision (spawning you on roofs etc...) Ziffixture 6913 — 3y
0
You should also be deleting the map after teleportation:P Ziffixture 6913 — 3y
0
Can you make an solution? Thanks. Akorede09broth 9 — 3y

3 answers

Log in to vote
0
Answered by 3 years ago

Howdy!

You need to specify that you want your player to go to the Vector3 of the brick called "Spawns". To do this, just get the property of it. Check out what I have below. It should work if there is a brick in the workspace called "Spawns". Also, I recommend you set that brick to be non-collide so that players aren't being shoved into bricks. (Although that does sound like fun.) ????????

choosemap:Destroy()
    for _,plr in pairs(game.Players:GetChildren()) do
        if plr.Backpack:FindFirstChild("Sword") then -- If the player has a sword, let's get rid of that and their gun.
            plr.Backpack.Sword:Destroy()
            if plr.Backpack:FindFirstChild("Handgun") then
                plr.Backpack.Handgun:Destroy()
            end -- here!    
        end
        for i,v in pairs(game.Players:GetPlayers()) do -- Time to send them all to the spawn point.
            v.Character:MoveTo(game.Workspace.Spawns.Position)
        end
    end
end

If this helped you out, consider accepting this answer for those sweet, sweet reputation points. If not, comment below and I (or someone else) will help you out.

Be sure to check out the Roblox API Documentation as well for additional reference.

0
I'll write an answer and tell me if it like that Akorede09broth 9 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

maybe try to take away the then in plr.Backpack.Handgun:Destroy()

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")   
            -- right here take away this and try it plr.Backpack.Handgun:Destroy()
            end -- here!    
                for i,v in pairs(game.Players:GetPlayers()) do
                    v.Character:MoveTo(Vector3.new(game.Workspace.Spawns))
                end
            end
        end
    end
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

Like this??

Thanks aswell.

choosemap:Destroy()
    for _,plr in pairs(game.Players:GetChildren()) do
        if plr.Backpack:FindFirstChild("Sword") then -- If the player has a sword, let's get rid of that and their gun.
            plr.Backpack.Sword:Destroy()
            if plr.Backpack:FindFirstChild("Handgun") then
                plr.Backpack.Handgun:Destroy()
            end -- here!    
        end
        for i,v in pairs(game.Players:GetPlayers(1)) do -- Time to send them all to the spawn point.
            v.Character:MoveTo(game.Workspace.Spawns.Position)
        end
    end
end

Answer this question