So I have this script,
local count = script.Parent.Height.Value wait(3) while true do if count < 7.5 then script.Parent.CFrame=script.Parent.CFrame+Vector3.new(0,0.1,0) count = count + 0.1 wait(0.1) else if count >= 7.5 then script.Parent.CFrame=script.Parent.CFrame+Vector3.new(0,-7.5,0) count = 7.5 end
but it doesnt work at the top line 'count' is a number value under the same group as the brick(the scripts parent)
the 'end' on the bottom line is underlined in red and says "expected 'end' (to close 'else' at line nine), got <eof>
I dont understand whats wrong? the idea is that the scripts parent gets raised in increases of .1 every 0.1 seconds until the height reaces 7.5 in which case it should lower the part by 7.5 studs and continue the proccess
You were missing an "end". That's the error you got. The while loop needs an end to determine where the loop stops. Also don't put .Value in a variable, I corrected that in the code.
local count = script.Parent.Height wait(3) while true do if count.Value < 7.5 then script.Parent.CFrame=script.Parent.CFrame+Vector3.new(0,0.1,0) count = count + 0.1 wait(0.1) else if count.Value >= 7.5 then script.Parent.CFrame=script.Parent.CFrame+Vector3.new(0,-7.5,0) count = 7.5 end end
You forgot to put end
after line 12 and dont use .Value in variables.
Here is the fixed script:
local count = script.Parent.Height wait(3) while true do if count.Value < 7.5 then script.Parent.CFrame=script.Parent.CFrame+Vector3.new(0,0.1,0) count.Value = count.Value + 0.1 wait(0.1) else if count.Value >= 7.5 then script.Parent.CFrame=script.Parent.CFrame+Vector3.new(0,-7.5,0) count.Value = 7.5 end end
Hope it helped :)