Whenever I run my game, either from Roblox Studio or from Roblox itself, my script will freeze then print Script Timeout in the output. here is the script.
local PlayersInQue = {}
wait(5)
while true do
script.Parent.Touched:Connect(function(Touched)
if Touched.Parent:FindFirstChild(“Humanoid”) then
local RootPart = Touched.Parent:WaitForChild(“HumanoidRootPart”)
RootPart.Position = game.Workspace.Queue.TP.CFrame.Position
table.insert(PlayersInQue,Touched.Parent)
local Timer = Instance.new("NumberValue")
Timer.Parent = game.ReplicatedStorage
Timer.Name = ("Timer")
Timer.Value = 60
local Fire = game.ReplicatedStorage.Fire
Fire:FireAllClients()
wait(60)
local TeleportService = game:GetService("TeleportService")
local EscapeRoomID = 5941082483
local ReservedServerCode = TeleportService:ReserveServer()
TeleportService:TeleportToPrivateServer(EscapeRoomID, ReservedServerCode, PlayersInQue)
end
end)
end
wait(5)
It freezes my game then stops running. This is 100% my script, with some help from devforum, and not open source, so it isnt some hidden virus in the game
You need debounce my dude. The touch physics in roblox aren’t perfect, so if you touch on a block or something it gets printed like a couple hundred times.
Ok. I may have located the issue. The While True Do loop at the beginning must have been firing many many times, and due to that, it must have ran the script many times before it needed to which caused lag. I just removed the while true do and it worked, so i am going to add in the while true do somewhere else