local tweenService = game:GetService("TweenService")
--creating floatTween
local floatTweenInfo = TweenInfo.new(
1, -- Time
Enum.EasingStyle.Quad, -- EasingStyle
Enum.EasingDirection.InOut, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
true, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
local floatGoal = {}
floatGoal.Position = script.Parent.Position + Vector3.new(0, .5, 0)
local floatTween = tweenService:Create(script.Parent, floatTweenInfo, floatGoal)
--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 = script.Parent.Orientation + Vector3.new(0, 360, 0)
local rotationTween = tweenService:Create(script.Parent, rotationTweenInfo, rotationGoal)
--main script
script.Parent.Changed:Connect(function()
if script.Parent.Parent == workspace then
floatTween:Play()
rotationTween:Play()
end
end)
This works perfectly. It floats up and down, and rotates slowly, as it should.
local tweenService = game:GetService("TweenService")
--main script
script.Parent.Changed:Connect(function()
if script.Parent.Parent == workspace then
--creating floatTween
local floatTweenInfo = TweenInfo.new(
1, -- Time
Enum.EasingStyle.Quad, -- EasingStyle
Enum.EasingDirection.InOut, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
true, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
local floatGoal = {}
floatGoal.Position = script.Parent.Position + Vector3.new(0, .5, 0)
local floatTween = tweenService:Create(script.Parent, floatTweenInfo, floatGoal)
floatTween:Play()
--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 = script.Parent.Orientation + Vector3.new(0, 360, 0)
local rotationTween = tweenService:Create(script.Parent, rotationTweenInfo, rotationGoal)
rotationTween:Play()
end
end)
But, suddenly, when I make NO CHANGES except put it in this function, it decides to stop working. But not completely stop working. Instead, it still (seems, at least) to rotate fine, but instead of floating up and down, it ever so slowly creeps upwards forever.
Why???
(This is in a server script, inside the object I am tweening)