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

Script ,if value == 1 while waiting ,not working?

im using that script,the last lines marked arent working.

while true do
	wait (3)
workspace.GasRadar.Handles.Visible = false
workspace.Mision.Value = 0
local model = workspace.GasAttack
local backup = model:Clone()
local c = Instance.new ("Message")
c.Text = "Gas Station Call"
c.Parent = game.Workspace
workspace.Part.Sound:Play()
wait (2)
workspace.Part.Sound:Stop()
wait(2)
c:Destroy()
model:remove()
workspace.GasRadar.Handles.Visible = true

wait(10)

model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()

--

local count = 0

while count < 120 do
    wait(1)
    count = count + 1
    if workspace.Mision.Value == 1 then  
        local c2 = Instance.new ("Message")  
        c2.Text = "Gas Station Call" 
        c2.Parent = game.Workspace 
        c2.Text = "All clear" 
--

end

end

5 comments

0

Messages are deprecated

0

There's a space between 'Instance.new' and '("Message")' on line 32

0

try to reduce the amount of loops you use in scripts. It can cause lag (from what I experienced too many loops can lag the server, causing loops to be slower)

0

@unsatisfie_d not necessarily. It depends on what code is being run within the loop. He's using the loop as a timer.

0

If my answer satisfies your question, please accept it.

1 answer

If you need help with a small part of an entire script, it would be helpful to just include the part you're having trouble with rather than the whole entire script.

With that said, I think your error lies in line 32. I have fixed it:

local count = 0

while count < 120 do
    wait(1)
    count = count + 1
    if workspace.Mision.Value == 1 then  --Is 'Mision' supposed to be spelled like that or do you mean 'Mission'?
        local c2 = Instance.new("Message")   --There was a space between 'Instance.new' and '("Message")'
        c2.Text = "Gas Station Call" 
        c2.Parent = game.Workspace 
        c2.Text = "All clear" 
	end
end

Also note that 'Message' is deprecated. The alternative is to use GUIs.

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