Please help my script just randomly broke even though i didnt modify it at all

last night my script was working perfectly fine, it now doesn’t work at all even though i hadn’t modified it.

	SpawnPart1 = workspace:WaitForChild("benefactor");
	SpawnPart2 = workspace:WaitForChild("MENUSPAWB");
	SpawnPart3 = workspace:WaitForChild("citizenspawn");
	SpawnPart4 = workspace:WaitForChild("rebelspawn");
	SpawnPart5 = workspace:WaitForChild("cwuspawn");
}
local GroupID = 16221838

game.Players.PlayerAdded:Connect(function(player)
	if player:GetRankInGroup(GroupID) ~= 255 then return end
	player.CharacterAdded:Connect(function(char)
		if player.Team.Name == "Combine" then char:PivotTo(spawns[string.format("SpawnPart1", player.Team.Name == "Combine")]:GetPivot() * CFrame.new(0, 2.5, 0))
		elseif player.Team.Name == "Menu" then char:PivotTo(spawns[string.format("SpawnPart2", player.Team.Name == "Menu")]:GetPivot() * CFrame.new(0, 2.5, 0))
		elseif player.Team.Name == "Citizens" then char:PivotTo(spawns[string.format("SpawnPart3", player.Team.Name == "Citizens")]:GetPivot() * CFrame.new(0, 2.5, 0))
		elseif player.Team.Name == "CWU" then char:PivotTo(spawns[string.format("SpawnPart5", player.Team.Name == "CWU")]:GetPivot() * CFrame.new(0, 2.5, 0))
		elseif player.Team.Name == "Rebel" then char:PivotTo(spawns[string.format("SpawnPart4", player.Team.Name == "Rebel")]:GetPivot() * CFrame.new(0, 2.5, 0))
		end
	end)
end) ```

it was a script to teleport me everytime i reset and join, and now it randomly broke, it doesnt even show up in the console
2 Likes

use bunch of print("Hello") to find where the code stops and whether it goes through the whole thing. You can also do print(player.Team.Name) to check and etc.

it runs the entire script, ive checked with the prints

The script seems to work in older versions, but I’ve done lots of updates to the game since then

local spawns = {
    Combine = workspace:WaitForChild("benefactor"),
    Menu = workspace:WaitForChild("MENUSPAWB"),
    Citizens = workspace:WaitForChild("citizenspawn"),
    Rebel = workspace:WaitForChild("rebelspawn"),
    CWU = workspace:WaitForChild("cwuspawn")
}

local GroupID = 16221838

game.Players.PlayerAdded:Connect(function(player)
    if player:GetRankInGroup(GroupID) ~= 255 then return end
    player.CharacterAdded:Connect(function(char)
        local spawnPart = spawns[player.Team.Name]
        if spawnPart then
            char:PivotTo(spawnPart:GetPivot() * CFrame.new(0, 2.5, 0))
        end
    end)
end)

Just looking to get this working … after that you can add your spawns points back in.

maybe something like this …

game.Players.PlayerAdded:Connect(function(player)
    if player:GetRankInGroup(GroupID) ~= 255 then return end
    player.CharacterAdded:Connect(function(char)
        local spawnPart = nil
        if player.Team.Name == "Combine" then 
            spawnPart = spawns.Combine
        elseif player.Team.Name == "Menu" then 
            spawnPart = spawns.Menu
        elseif player.Team.Name == "Citizens" then 
            spawnPart = spawns.Citizens
        elseif player.Team.Name == "CWU" then 
            spawnPart = spawns.CWU
        elseif player.Team.Name == "Rebel" then 
            spawnPart = spawns.Rebel
        end
        if spawnPart then
            char:PivotTo(spawnPart:GetPivot() * CFrame.new(0, 2.5, 0))
        end
    end)
end)