Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Minigame script will not work in game but works in game. Will not change text of gui?

So, this script is a Normal Script inside of ServerScriptService and it will not change the text of the text label inside of Timer.

Script:

local maps = {}
local Player = {}

game.Players.PlayerAdded:Connect(function(plr)
	table.insert(Player,plr.Name)
end)

for i,v in pairs(game.ReplicatedStorage.Maps:GetChildren()) do
	if v:IsA("Model") then
		table.insert(maps,v.Name)
		table.sort(maps)
	end
end

while true do
	wait()
	for i,v in pairs(game.Players:GetChildren()) do
		if i >= 1 then
			for timee = 30, 0, -1 do
				wait(1)
				for i,v in pairs(Player) do
					game.Players[v].PlayerGui.Timer.TextLabel.Text = "Game Starting In "..timee.." Seconds..."
				end
				if timee == 0 then
					for i,v in pairs(Player) do
						game.Players[v].PlayerGui.Timer.TextLabel.Text = "Teleporting Players..."
						wait(0.5)
					end
				end
			end
			local PickedMap = maps[math.random(1,#maps)]
			local CloneMap = game.ReplicatedStorage.Maps[PickedMap]:Clone()
			CloneMap.Parent = game.Workspace
			for i,plr in pairs(Player) do
				for i,map in pairs(CloneMap:GetChildren()) do
					if map.Name == "Spawn" then
						game.Workspace[plr]:SetPrimaryPartCFrame(map.CFrame)
					end
				end
			end
			for t = 120, 0, -1 do
				wait(1)
				for i,v in pairs(Player) do
					game.Players[v].PlayerGui.Timer.TextLabel.Text = "Game Ends In "..t.." Seconds..."
				end
				if t == 0 then
					game.Workspace[PickedMap]:Destroy()
					wait(1)
				end
			end
		end
	end
end

Thank You For Your Help!

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.