Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TweenAngle = function(Weld, DestinationCF, Time)
- if (TweenExclusions[Weld] ~= true or Ignore) then
- local Key = Weld;
- Tween_Data[Key] = (Tween_Data[Key] == nil) and 1 or Tween_Data[Key] + 1;
- local Current_Iteration = Tween_Data[Key];
- Spawn(function()
- local OldAngle = Vector3.new(Weld.C1:toEulerAnglesXYZ())
- local NewAngle = Vector3.new(DestinationCF:toEulerAnglesXYZ())
- local PercentageComplete = 0
- local TimeStarted = tick()
- while PercentageComplete <= 1 do
- PercentageComplete = math.min((tick()-TimeStarted)/Time, 1)
- if (Tween_Data[Key] == Current_Iteration) and (TweenExclusions[Weld] ~= true) then
- Weld.C1 = CFrame.Angles(
- (OldAngle.x*(1-PercentageComplete))+(NewAngle.x*PercentageComplete),
- (OldAngle.y*(1-PercentageComplete))+(NewAngle.y*PercentageComplete),
- (OldAngle.z*(1-PercentageComplete))+(NewAngle.z*PercentageComplete)
- )
- SteppedWait()
- else
- break
- end
- end
- if (Tween_Data[Key] == Current_Iteration) and (TweenExclusions[Weld] ~= true) then
- Weld.C1 = DestinationCF
- end
- if PercentageComplete==1 then
- break
- end
- end)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement