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

Unexpected argrument near status?

while true do
-- Intermission
for i = 30,0,-1 do
status.Value = "Intermission: "..i 
wait (1) 
end
local map = game.ServerStorage.GlassMap
map:Clone().Parent = game.Workspace
wait (15)
game.Workspace.GlassMap:Destroy
status.Value = "Game End"
end

the code status.Value = "Game End" the status is highlighted red in it any reason why?

2 comments

0

Edited for code block.

1

Where is status defined? EDIT: You forgot the parenthesis at the end of Destroy on line 10. It's supposed to be :Destroy()

1 answer

Methods/functions are always invoked using parenthesis, even if you're not putting anything in the parenthesis:

game.Workspace.GlassMap:Destroy() -- line 10

It expected to see an argument (something inside parenthesis) but instead saw the word status.


Cleanup

You should use workspace instead of game.Workspace.

On line 10, you should use map instead of saying workspace.GlassMap -- since that's what you mean.

You should tab and space your code properly. Increase the indent one level in each "block" (inside a while, for, if, function, etc.

This shows how statements are "grouped" together, and makes it much easier to edit code.

I also suggest using the standard spacing for functions and operators: put spaces around operators like .., don't put spaces before the () in a function, and put spaces after a comma:

while true do
	-- Intermission
	for i = 30, 0, -1 do
		status.Value = "Intermission: " .. i 
		wait(1) 
	end
	local map = game.ServerStorage.GlassMap:Clone()
	map.Parent = workspace
	wait(15)
	map:Destroy()
	status.Value = "Game End"
end

2 comments

1

Shouldn't line 7 be "local map = game.ServerStorage.GlassMap:Clone()" and remove the clone method on line 8? Otherwise, you'd be destroying the original map, I think.

0

@GoldenPhysics you're absolutely right, fixed

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