Hello, I have a variable and it’s different when I print the same exact thing.
Print: ElavatorScript:25 down -1 1
Script:
local Elavator = workspace.Levels.Elavator
if goal_level > current_level then
goal_level = (goal_level - current_level)
elseif goal_level == current_level then
return
else
goal_level = current_level - goal_level*-2
print("down", current_level - goal_level*2, goal_level) -- Prints "down, -1, 1"
end
current_level = goal_level
local goal = Elavator.PrimaryPart.CFrame * CFrame.new(0, goal_level * 16, 0)
local distance = (Elavator.PrimaryPart.Position - goal.Position).Magnitude
local elavatorTweenInfo = TweenInfo.new(distance/8, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local tween = TweenService:Create(Elavator.PrimaryPart, elavatorTweenInfo, {CFrame = goal})
tween:Play()
tween.Completed:Wait()
Thank you