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

I Broke a Script by Editing Another???

Asked by
tber8 37
7 years ago

I went into my game after testing this script and having it work:

local function onPlayerEntered(newPlayer)
    newPlayer.CameraMaxZoomDistance = 8
    newPlayer.Character.Torso.CFrame = game.Workspace.Tele2.CFrame
    local lol = script.MenuGui:Clone()
    local lol2 = script.StartGui:Clone()
    lol.Sound.Playing = true
    lol.Parent = newPlayer.PlayerGui
    lol2.Frame.Script.Disabled = false
    lol2.Frame.TextLabel2.Script.Disabled = false
    lol2.Parent = newPlayer.PlayerGui
end 

game.Players.PlayerAdded:connect(onPlayerEntered) 

This script causes the start menu and start animation GUI to open. It turns on the menu music and animation scripts. It also changes how far out a player can scroll.

After adding a new section to my game's main script, this script broke 100%. Not one thing in the script worked, while the main script worked. The addition to the main script was the following:

math.randomseed(os.time());
    local list = {};
    function foo()
    for index, child in pairs(game.ReplicatedStorage.Maps:GetChildren()) do
        wait();
        list[index] = child;
    end
    randomMap = list[math.random(1,table.getn(list))]:Clone();
    randomMap.Parent = game.Workspace.MapHolder;

end
foo();

locations = randomMap.Spawns

for _,v in pairs(game.Players:GetChildren()) do
    local spawnlocation = locations:FindFirstChild('Part')
    v.Character.Torso.CFrame = spawnlocation.CFrame
    spawnlocation.Parent = spawnlocation.Parent.Parent
end

Feel free to comment a question. I need all the help I can get.

0
Errors in output? RubenKan 3615 — 7y
0
Can you specify which is the main script and which is the broken one. I understand you're code,but I want to know which is broken since it seems like you are using tables incorrectly in the second one. Meltdown81 309 — 7y
0
the second is the main script, but the first broke tber8 37 — 7y

Answer this question