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

Why does loading take so long for my place?

Asked by
mine248 40
8 years ago

I have a place that uses PlayerRemoved script. But when using in online mode, it don't load a lot. Any solutions?

Faulty code:

local replicated = game:GetService("ReplicatedStorage")

game.Players.PlayerRemoving:connect(function(player)
    if replicated.Track1.Value == player.Name then
        replicated.Track1.ok.Value = true
    elseif replicated.Track3.Value == player.Name then
        replicated.Track3.ok.Value = true
    elseif replicated.Track4.Value == player.Name then
        replicated.Track4.ok.Value = true
    end
end)

Faulty code 2:


local Track1 = script.Parent.Background:WaitForChild("Track1") local Track3 = script.Parent.Background:WaitForChild("Track3") local Track4 = script.Parent.Background:WaitForChild("Track4") local player = game.Players.LocalPlayer local Name = player.Name local replicated = game:GetService("ReplicatedStorage") local Annoucements = script.Parent:WaitForChild("Annoucements") local Helper = script.Parent:WaitForChild("Helper") local Say = Annoucements:WaitForChild("Say") local Do = Helper:WaitForChild("Do") script.Parent.Background.Track1.MouseButton1Click:connect(function() torso = player.Character:WaitForChild("Torso") humanoid = player.Character:WaitForChild("Humanoid") if torso and humanoid then torso.CFrame = CFrame.new(workspace["R62_Trk1"].Model.VehicleSeat.Position + Vector3.new(0, 3, 0)) script.Parent.Background:Destroy() script.Parent.Annoucements.Visible = true script.Parent.Helper.Visible = true script.Parent.ChatFrame.Visible = true replicated.Track1.Value = Name replicated.Track1.ok.Value = false end end) script.Parent.Background.Track3.MouseButton1Click:connect(function() torso = player.Character:WaitForChild("Torso") humanoid = player.Character:WaitForChild("Humanoid") if torso and humanoid then torso.CFrame = CFrame.new(workspace["R62_Trk3"].Model.VehicleSeat.Position + Vector3.new(0, 3, 0)) script.Parent.Background:Destroy() script.Parent.Annoucements.Visible = true script.Parent.Helper.Visible = true script.Parent.ChatFrame.Visible = true replicated.Track3.Value = Name replicated.Track3.ok.Value = false end end) script.Parent.Background.Track4.MouseButton1Click:connect(function() torso = player.Character:WaitForChild("Torso") humanoid = player.Character:WaitForChild("Humanoid") if torso and humanoid then torso.CFrame = CFrame.new(workspace["R62_Trk4"].Model.VehicleSeat.Position + Vector3.new(0, 3, 0)) script.Parent.Background:Destroy() script.Parent.Annoucements.Visible = true script.Parent.Helper.Visible = true script.Parent.ChatFrame.Visible = true replicated.Track4.Value = Name replicated.Track4.ok.Value = false end end) local instructions1 = { "Hello! I'm mine248 and I'll be teaching you how to operate this train.", "Press the up key or W to go forwards.", "Press the down key or S to go backwards.", 'Check the box labeled "Annoucments."', 'Chat what the box labeled "Annoucments." says.', 'When it says "Stand clear of the closing doors", say it and then close the door.', 'When it says "Stand clear of the closing doors", say it and then close the door.' --etc } local step = 1 script.Parent.Helper.TextButton.MouseButton1Click:connect(function() Do.Text = instructions1[step] step = (step % #instructions1) + 1 if step == 7 then script.Parent.Helper:Destroy() end end) local instructions2 = { "This is a Grand Central bound shuttle train.", "The next stop is Grand Central-42nd Street.", "Stand clear of the closing doors please.", "DO NOT SAY ANYTHING UNTIL IT'S APPROCHING GRAND CENTRAL. Then click Next.", "This is Grand Central-42nd Street. Transfer is available to the 4, 5, 6, and 7 trains. Connections is available to the Metro North.", "DO NOT SAY ANYTHING UNTIL THE TRAIN STOPS AND YOU OPEN THE DOOR.", "This is the last stop on the train. Please leave the train.", 'This is a Times Square bound shuttle train.', 'The next stop is Times Square-42nd Street.', "Stand clear of the closing doors please.", "DO NOT SAY ANYTHING UNTIL IT'S APPROCHING TIMES SQUARE. Then click Next.", "This is Times Square-42nd Street. Transfer is available to the 1, 2, 3, 7, A, C, E, N, Q, and R trains. Connections is available to the Port Authority Bus Terminal.", "DO NOT SAY ANYTHING UNTIL THE TRAIN STOPS AND YOU OPEN THE DOOR.", "This is the last stop on the train. Please leave the train." --etc } local step2 = 1 script.Parent.Annoucements.TextButton.MouseButton1Click:connect(function() Say.Text = instructions2[step2] step2 = (step2 % #instructions2) + 1 end) while true do if replicated.Track1 and replicated.Track1.ok.Value == false then Track1.Visible = false elseif replicated.Track3 and replicated.Track3.ok.Value == false then Track3.Visible = false elseif replicated.Track4 and replicated.Track4.ok.Value == false then Track4.Visible = false elseif replicated.Track1 and replicated.Track1.ok.Value == true then Track1.Visible = true elseif replicated.Track3 and replicated.Track3.ok.Value == true then Track3.Visible = true elseif replicated.Track4 and replicated.Track4.ok.Value == true then Track4.Visible = true end end
0
add repeat wait() until game.Players.LocalPlayer.Character at top of every local scripts. User#5978 25 — 8y
0
It breaks the purpose. mine248 40 — 8y

Answer this question