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

my minigame script is supposed to be in a local script, but it doesn't work in the real game?

this script i am making is a map and round starter, like those games with lots of minigames. it is a local script parented in playerscripts. here it is:

ready = true
local timer = game.ServerStorage.Time
local msg = game.ServerStorage.MSG

while ready == true do
	wait(.1)
	game.Players.LocalPlayer.PlayerScripts.LocalScript.Disabled = true
	timer.Value = 30
	for i = timer.Value,0,-1 do
		timer.Value = timer.Value - 1
		msg.Value = i.. " Seconds until next match!"
		game.Players.LocalPlayer.PlayerGui.ScreenGui2.TextLabel.Text = msg.Value
		wait(1)
	end
	local chosen = math.random(1,3)
	if chosen == 1 then
		msg.Value = '"Ice Cold" has been chosen!'
			game.Players.LocalPlayer.PlayerGui.ScreenGui2.TextLabel.Text = msg.Value
		wait(1)
		msg.Value = "Intermission..."
			game.Players.LocalPlayer.PlayerGui.ScreenGui2.TextLabel.Text = msg.Value
		local copy = game.ServerStorage["Ice Cold"]:Clone()
		copy.Parent = game.Workspace
		wait(5)
		local randomspawn = copy.randomspawns:GetChildren()
		local spawns = randomspawn[math.random(1,#randomspawn)]
		game.Players.LocalPlayer.Character:MoveTo(spawns.Position)
		 
		game.Players.LocalPlayer.PlayerScripts.LocalScript.Disabled = false
		timer.Value = 60
		for v = 4,0,-1 do
				for i = 60,0,-1 do
					timer.Value = timer.Value - 1
					msg.Value = v..":"..i.. "Seconds until match is over!"
						game.Players.LocalPlayer.PlayerGui.ScreenGui2.TextLabel.Text = msg.Value
					wait(1)
					
				end
				game.ServerStorage.Minute.Value = game.ServerStorage.Minute.Value - 1 
				end
	end
	if chosen == 2 then
		msg.Value = '"Lava Dungeon" has been chosen!'
			game.Players.LocalPlayer.PlayerGui.ScreenGui2.TextLabel.Text = msg.Value
		wait(1)
		msg.Value = "Intermission..."
			game.Players.LocalPlayer.PlayerGui.ScreenGui2.TextLabel.Text = msg.Value
		local copy = game.ServerStorage.LavaDungeon:Clone()
		copy.Parent = game.Workspace
		wait(5)
		local randomspawn = copy.randomspawns:GetChildren()
		local spawns = randomspawn[math.random(1,#randomspawn)]
		game.Players.LocalPlayer.Character:MoveTo(spawns.Position)
		 
		game.Players.LocalPlayer.PlayerScripts.LocalScript.Disabled = false
		timer.Value = 60
		
			for v = 4,0,-1 do
				for i = 60,0,-1 do
					timer.Value = timer.Value - 1
					msg.Value = v..":"..i.. "Seconds until match is over!"
						game.Players.LocalPlayer.PlayerGui.ScreenGui2.TextLabel.Text = msg.Value
					wait(1)
				end
				game.ServerStorage.Minute.Value = game.ServerStorage.Minute.Value - 1 
			end
			
	end
	if chosen == 3 then
			msg.Value = '"The Decks" has been chosen!'
				game.Players.LocalPlayer.PlayerGui.ScreenGui2.TextLabel.Text = msg.Value
		wait(1)
		msg.Value = "Intermission..."
			game.Players.LocalPlayer.PlayerGui.ScreenGui2.TextLabel.Text = msg.Value
		local copy = game.ServerStorage["The Decks"]:Clone()
		copy.Parent = game.Workspace
		wait(5)
		local randomspawn = copy.randomspawns:GetChildren()
		local spawns = randomspawn[math.random(1,#randomspawn)]
		game.Players.LocalPlayer.Character:MoveTo(spawns.Position)
		 
		game.Players.LocalPlayer.PlayerScripts.LocalScript.Disabled = false
		timer.Value = 60
		
			for v = 4,0,-1 do
				for i = 60,0,-1 do
					timer.Value = timer.Value - 1
					msg.Value = v..":"..i.. "Seconds until match is over!"
						game.Players.LocalPlayer.PlayerGui.ScreenGui2.TextLabel.Text = msg.Value
					wait(1)
				end
				game.ServerStorage.Minute.Value = game.ServerStorage.Minute.Value - 1 
			end
			end
	end

1 comment

0

Why are you using a local script for a timer countdown and round starter? You should use a normal script, or else everyone will experience rounds at diffrent times

1 answer

Local Scripts can not access ServerStorage

Use ReplicatedStorage instead.

1 comment

0

He shouldn't. He's doing this completely wrong. You should never, ever, use a local script for stuff like this. He should put the code in a normal script and put that in serverscriptservice.

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