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

This while loop is running well but with different timing for each player from when he joined?

Hey.. I've been making a random pick script which picks different maps every time. The script works well, and everything is good. But the timing of the while loop is different for each player from the time he joined. The while loops fires every 115 secounds but it does it for each player 115 secounds after he JOINED and not the same timing for everyone. Here's the script :

while wait(115) do
	local Construction = game.Workspace.Construction
	local Egypt = game.Workspace.Egypt
	local SnowLand = game.Workspace.SnowLand
	local TheMaze = game.Workspace.TheMaze
	local TheTown = game.Workspace.TheTown
	local TreeLand = game.Workspace.TreeLand
	local Options = {Construction, Egypt, SnowLand, TheMaze, TheTown, TreeLand}
	Construction = 1
	Egypt = 2
	SnowLand = 3
	TheMaze = 4
	TheTown = 5
	TreeLand = 6
	
	local Result = math.random(1, 6)
	if Result == 1 then
		game.Players.LocalPlayer.PlayerGui.ConstructionChosen.Enabled = true
		wait(5)
		game.Players.LocalPlayer.PlayerGui.ConstructionChosen.Enabled = false
	end
	
	if Result == 2 then
		game.Players.LocalPlayer.PlayerGui.EgyptChosen.Enabled = true
		wait(5)
		game.Players.LocalPlayer.PlayerGui.EgyptChosen.Enabled = false
	end
	
	if Result == 3 then
		game.Players.LocalPlayer.PlayerGui.SnowLandChosen.Enabled = true
		wait(5)
		game.Players.LocalPlayer.PlayerGui.SnowLandChosen.Enabled = false
	end
	
	if Result == 4 then
		game.Players.LocalPlayer.PlayerGui.TheMazeChosen.Enabled = true
		wait(5)
		game.Players.LocalPlayer.PlayerGui.TheMazeChosen.Enabled = false
	end
	
	if Result == 5 then
		game.Players.LocalPlayer.PlayerGui.TheTownChosen.Enabled = true
		wait(5)
		game.Players.LocalPlayer.PlayerGui.TheTownChosen.Enabled = false
	end
	
	if Result == 6 then
		game.Players.LocalPlayer.PlayerGui.TreeLandChosen.Enabled = true
		wait(5)
		game.Players.LocalPlayer.PlayerGui.TreeLandChosen.Enabled = false
	end
end

Can someone help me?

4 comments

0

This is because it is a LocalScript. It will only effect each player individually. You’ll need to rewrite your code to operate via the Server.

0

It happens often and it's because there's a bug, make sure what type is the script. If it is script is of type "Localscript" only serves one player. And the script is for the server in general.

0

Use a server script

0

Local script is client-sided while server scripts are server-sided

1 answer

Ocurre a menudo y es porque hay un error, asegúrese de qué tipo es el script. Si el script es del tipo "Localscript" solo sirve a un jugador. Y el script es para el servidor en general.

2 comments

0

English translation:                     "It happens often and it's because there's a bug, make sure what type is the script. If it is script is of type "Localscript" only serves one player. And the script is for the server in general."

0

The point is going through the playergui. And going through the playergui by a normal script is impossible.

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