What did I do wrong? This script seems to break on line 4.
function Glide(CurrentPos,TargetPos,speed) if CurrentPos < TargetPos then return math.min(TargetPos,CurrentPos + speed) elseif CurrentPos > TargetPos return math.max(TargetPos,CurrentPos - speed) else return TargetPos end end Glide(CurrentPos,TargetPos,speed)
On Line 4 you forgot to use a then. It will not check without the entire if then statement. Then Closes the statement.
http://wiki.roblox.com/index.php?title=Conditional_statement#Elseif
function Glide(CurrentPos,TargetPos,speed) if CurrentPos < TargetPos then return math.min(TargetPos,CurrentPos + speed) elseif CurrentPos > TargetPos then return math.max(TargetPos,CurrentPos - speed) else return TargetPos end end Glide(CurrentPos,TargetPos,speed)
Hope this helps! :)