I have a problem where every script in my game is getting timed out for some reason. Even the scripts with no loops in them whatsoever. I have looked over my script many times and I believe I am scripting correctly. I have scripted like this in some other games of mine and they work perfectly. Is my game possibly hacked?
Here are all the scripts with this problem (all of them lol):
Move: This script is used for the lava to rise in my rising lava game
while wait(1) do
if script.Parent.Parent == workspace then
script.Parent.CFrame = script.Parent.CFrame+Vector3.new(0, .5, 0)
end
end
Kill: This script is in the lava to kill the player and this one gets a timeout as well
script.Parent.Touched:Connect(function(part)
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
h.Health = 0
end
end)
Round System: This is the script that controls the game and has the most timeouts
-- Variables --
local roundLength = 35
local intermissionLength = 15
local inRound = game.ReplicatedStorage.InRound
local lobbySpawn = game.Workspace.LobbySpawn
local GameAreaSpawn = game.Workspace.GameAreaSpawn
local Status = game.ReplicatedStorage.Status
local mapGenerated = false
local mapsFolder = game.ReplicatedStorage.Maps
local totalMaps = #mapsFolder:GetChildren()
inRound.Changed:Connect(function()
if inRound.Value == true then
local randomap = math.random(1,totalMaps)
print(randomap)
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
-- Map Selection --
if mapGenerated == false then
mapGenerated = true
clone = game.ReplicatedStorage.Maps[tostring(randomap)]:Clone()
clone.Parent = workspace
end
char.HumanoidRootPart.CFrame = GameAreaSpawn.CFrame
wait()
end
else
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
-- Reset for Intermission --
if mapGenerated == true then
mapGenerated = false
clone:Destroy()
end
char.HumanoidRootPart.CFrame = lobbySpawn.CFrame
wait()
end
end
end)
local function roundTimer()
while wait() do
for i = intermissionLength, 1, -1 do
inRound.Value = false
wait(1)
Status.Value = "Intermission "..i.." seconds left"
end
for i = roundLength, 1, -1 do
inRound.Value = true
wait(1)
Status.Value = "LAVA IS RISING: "..i.." seconds left"
end
end
end
spawn(roundTimer)
I am possibly thinking about bringing the scripts over to a new game because I feel like something is wrong with that game in the studio.
What do you guys think? Reply if you have any suggestions or solutions.