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

My script does not error and doesn't work? It is an obby script that changes your respawnlocation.

Asked by 3 years ago
Edited 3 years ago

So this script is meant to change your respawnlocation to another respawnlocation that is higher. However, the script doesn't work and it doesn't give an error I can work on.

Script:

--AllCheckpoints is a table of all the checkpoint models in the game. Each spawn is in a model.

for i, v in pairs(AllCheckpoints) do
    if not (v == script) then
        v.Spawn.Touched:Connect(function(hit)
            if hit.Parent:FindFirstChild("Humanoid") then
                local char = hit.Parent
                if not (char.Humanoid.Health == 0) then 
                    local plrSpawn = game.Players:GetPlayerFromCharacter(char).RespawnLocation
                    if plrSpawn:GetAttribute("Stage") < v.Spawn:GetAttribute("Stage") then
                        plrSpawn = v.Spawn
                    end
                end
            end
        end)
    end
end

Answer this question