Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Unexpected argrument near status?

Asked by 8 years ago
Edited by M39a9am3R 8 years ago
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?

0
Edited for code block. M39a9am3R 3210 — 8y
1
Where is status defined? EDIT: You forgot the parenthesis at the end of Destroy on line 10. It's supposed to be :Destroy() M39a9am3R 3210 — 8y

1 answer

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
8 years ago
Edited 8 years ago

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
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. GoldenPhysics 474 — 8y
0
@GoldenPhysics you're absolutely right, fixed BlueTaslem 18071 — 8y
Ad

Answer this question