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

Error in my play sound on brick velocity script. can someone help me fix this error?

Asked by 6 years ago

Some context: I want a brick to play a sound when a brick starts to attain velocity.

very simple script that won't work for an error at line 3 (While).

The error is "expected identifier, found "while"

local seat = script.Parent
local sound = script.Parent.Sound.
while wait(0.1) do
if seat.Velocity.magnitude >= 150 then --play sound if velocity is greater than or equal to 150
if not sound:IsPlaying() then --don't play it again if its already playing.
sound:Play()
end
else -- if it isn't then don't play the sound.
if sound:IsPlaying() then -- don't need to stop a song that isn't playing.
sound:Stop()
end
end
end
0
It seems you have made a typo before the while statement on line 3: There's an extra period after script.Parent.Sound PyccknnXakep 1225 — 6y
0
You could have easily solved this by looking at the output. hiimgoodpack 2009 — 6y

Answer this question