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

Roblox spawn points and leaderboard not working? (with script)

Asked by
2mania 14
1 year ago

Hi I was testing out a leaderboard thingy and basically if its set to 1 then you go to one spawn point but if its set to 2 then you go to another here is the script lmk if I did something wrong I need help :(

local players = game:GetService("Players")

game.Players.PlayerAdded:Connect(function(player)
    if player then
        local folder = Instance.new('Folder')
        folder.Name = 'leaderstats'
        folder.Parent = player
        local level = Instance.new('IntValue')
        level.Name = "levelstage"
        level.Parent = folder
        level.Value = 2
    end
end)
wait(1)
game.Players.PlayerAdded:Connect(function(player)
    if player then
        if player.leaderstats.levelstage.Value == 1 then
            player.RespawnLocation = game.Workspace.noob
        else if player.leaderstats.levelstage.Value == 2 then
                player.RespawnLocation = game.Workspace.SpawnLocation
            end
        end
    end
end)

Answer this question