#Reseting a players spawn.

4 messages · Page 1 of 1 (latest)

tulip spoke
#

Hello, I need help with resetting my players spawn. When a map is called, it turns off the original maps spawns, and activates the new maps spawn. But when I reset the character, the spawn doesn't load, and it just spawns me at 0,0

Here is my code:


local plr = game.Players.LocalPlayer
local screengui = plr.PlayerGui.SpawnWhere
local desert = screengui.Desert
local forest = screengui.Forest
local df = game.Workspace.Forest
local dd = game.Workspace.desert
local mt = false
local UIS = game:GetService("UserInputService")

local plrm = require(game:GetService("Players").LocalPlayer.PlayerScripts:WaitForChild("PlayerModule"))
local controls = plrm:GetControls()

local s1 
local s2 
local s3 
local s4
local s5
local s6


UIS.InputBegan:Connect(function(input,gpe)
    if gpe then return end

    if input.KeyCode == Enum.KeyCode.M then
        screengui.Enabled = not screengui.Enabled 
        mt = not mt
        if mt then
            controls:Disable()
            workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
        else
            controls:Enable()
            workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
        end

    end


end)

forest.MouseButton1Click:Connect(function()
    for c,chi in df:GetChildren() do

        print(chi)
        if c == 1 then
            s1 = chi
        elseif c == 2 then
            s2 = chi
        elseif c==3  then
            s3 = chi
        elseif c==4 then
            s4 = chi
        elseif c==5 then
            s5 = chi
        elseif c==6 then
            s6 = chi
        end
    end
    for _,chi in dd:GetChildren()  do
        chi.Enabled = false
    end
    local ran = math.random(1,6)
    if ran== 1 then
        s1.Enabled = true
    elseif ran == 2 then
        s2.Enabled = true
    elseif ran ==3  then
        s3.Enabled = true
    elseif ran==4 then
        s4.Enabled = true
    elseif ran==5 then
        s5.Enabled = true
    elseif ran==6 then
        s6.Enabled = true
    end

    print("goodbye")
    controls:Enable()
    workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
    screengui.Enabled = false
    mt = false
    controls:Enable()
    plr.Character.Humanoid.Health = 0



end)

desert.MouseButton1Click:Connect(function()
    print("hello")
    for c,chi in dd:GetChildren()  do
        print(chi)
        if c == 1 then
            s1 = chi
        elseif c == 2 then
            s2 = chi
        elseif c ==3  then
            s3 = chi
        elseif c==4 then
            s4 = chi
        elseif c==5 then
            s5 = chi
        elseif c==6 then
            s6 = chi
        end
    end
    for _,chi in df:GetChildren()  do
        chi.Enabled = false
    end
    local ran = math.random(1,6)
    if ran== 1 then
        s1.Enabled = true
    elseif ran == 2 then
        s2.Enabled = true
    elseif ran ==3  then
        s3.Enabled = true
    elseif ran==4 then
        s4.Enabled = true
    elseif ran==5 then
        s5.Enabled = true
    elseif ran==6 then
        s6.Enabled = true
    end

    screengui.Enabled = false
    controls:Enable()
    workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
    mt = false
    plr.Character.Humanoid.Health = 0
  


end)

meager wing
#

dont use the roblox spawns, use a part and manually move the humanoid to the spawn coordinates

meager wing
#

loop them and pick one