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

2 comments
It seems you have made a typo before the while statement on line 3: There's an extra period after script.Parent.Sound
You could have easily solved this by looking at the output.