Dear Answerer,

I am making a game that has a game loop. The game loop works in Roblox Studio but does not work in normal playing on a server. The Game Loop (which is named Game Loop) was in Workspace. I then transferred it to ServerScriptService. And it still does not work. Any ideas on why? Script is placed below.

--RadioactiveSherbet

local winBoard = game.Workspace.Stationary.LobbyInternal.Jackel.SurfaceGui.TextLabel
local forest = game.ServerStorage.Maps["Forest Map"]
local plains = game.ServerStorage.Maps["The Great Plains"]
local Maps = game.ServerStorage:WaitForChild("Maps"):GetChildren()
local ChosenMap = Maps[math.random(1, #Maps)]



function Intermission()
			local IntermissionTime = 20
			wait(.1)
		while IntermissionTime ~= 0 do
			for _, player in pairs(game.Players:GetChildren()) do
			wait(.1)
		local playergui = player.PlayerGui
		local text = playergui.ScreenGui:WaitForChild('TextLabel')
				wait(.5)
				text.Text = "Intermission: " .. IntermissionTime
				wait(.3)
				IntermissionTime = IntermissionTime - 1
			end
		end
	
	
	
end


function HideTimer()
			local HideTime = 20
			wait(.1)
		while HideTime ~= 0 do
			for _, player in pairs(game.Players:GetChildren()) do
			wait(.1)
		local playergui = player.PlayerGui
		local text = playergui.ScreenGui:WaitForChild('TextLabel')
				wait(.5)
				text.Text = "Time Left To Hide: " .. HideTime
				wait(.3)
				HideTime = HideTime - 1
			end
		end
	
	
	
end


function TeleportAllPlayers()
	local target = Vector3.new(67, 39.5, 9)
for i, v in pairs(game.Players:GetChildren()) do
v.Character.Torso.CFrame = CFrame.new(target + Vector3.new(0, i * 5, 0)) 
end
end


function TeleportTo()
	local targeto = Vector3.new(10, 64.529, 11)
for i, v in pairs(game.Players:GetChildren()) do
v.Character.Torso.CFrame = CFrame.new(targeto + Vector3.new(0, i * 5, 0)) 
end
end


function spawnMap()
        ChosenMap:Clone().Parent = workspace
end


function deleteMap()
	game.Workspace:FindFirstChild(ChosenMap.Name):Destroy()
end


function GameTimer()
			local GameTime = 90
			wait(.1)
		while GameTime ~= 0 do
			for _, player in pairs(game.Players:GetChildren()) do
			wait(.1)
		local playergui = player.PlayerGui
		local text = playergui.ScreenGui:WaitForChild('TextLabel')
				wait(.5)
				text.Text = "Avoid The Sickness: " .. GameTime
				wait(.3)
				GameTime = GameTime - 1
			end
		end
	
	
	
end

function ChangeText(message)
	for _, player in pairs(game.Players:GetChildren()) do
		local playerguizz = player.PlayerGui
		local texzt = playerguizz.ScreenGui:WaitForChild('TextLabel')
				wait(.5)
				texzt.Text = message
				wait(.3)
	end
end

function AwardPlayers(Player)
	
	 Player.leaderstats.sCoins.Value = Player.leaderstats.sCoins.Value + 25
	 Player.LoadCharacter()
end

function Release()
	local sickClone = game.ServerStorage.DFDIllness:Clone()
	sickClone.Parent = game.Workspace
end

function DestroyClone()
	game.Workspace.DFDIllness:Destroy()
end






while wait(.1) do
Intermission()
spawnMap()
ChangeText("Teleporting Players...")
TeleportAllPlayers()
HideTimer()
Release()
GameTimer()
DestroyClone()
TeleportTo()
for _, players in pairs(game.Players:GetChildren()) do
	if players.Character.Torso.Material == "Plastic" then
		AwardPlayers(players)
	end
end
deleteMap()
	
	
	
	
end

3 comments

0

Beat me there Satire.

0

There's lots of things that need to be changed in this script if Filtering is Enabled. But the one easy advice I would give you is that scripts can not change Player Gui. Use Remote Events to connect the script to a local script. Good Luck! I use to have this problem a lot too.