This script uses tween service to slowly rotate a coin.
--this script is gonna animate the power up and make it spin and oooooooooooooooooooooo pretty
local tweenService = game:GetService("TweenService")
--creating rotationTween
local rotationTweenInfo = TweenInfo.new(
5, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
local rotationGoal = {}
rotationGoal.Orientation = Vector3.new(0, 360, 0)
local rotationTween = tweenService:Create(script.Parent, rotationTweenInfo, rotationGoal)
--main script
rotationTween:Play()
This script makes it float up and down with an animation.
--this script plays the float animation with the animation controller
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://8689943119"
local loadAnimation = script.Parent.AnimationController.Animator:LoadAnimation(animation)
loadAnimation:Play()
Individually, they work fine, but together, the rotating seems to work, but it flies upwards into the heavens. The animation makes it go up .5 studs for 1 second, and down .5 studs for 1 second. It seems to go down .5 studs for 1 second, but when it goes up it goes like 50 studs for 1 second, then repeat both of those.
What on Earth is going wrong?