Hello.
I am having a weird issue that i cannot find out.
so basically i made an helicopter that moves on the server
and the propellers are handled on the client using a remote event to change their status
and a bindable event to interact with the module script
when they get set to their first status (landed) it does work
but i am having a issue with (leaving) where the previous tween doesnt stop and instead it plays both tweens.
local Propeller = {}
local TweenService = game:GetService("TweenService")
Propeller.new = function(Information)
if Information then
local PropellerNew = Information.Propeller
local Info = TweenInfo.new(0, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1)
local Time
local BindableEvent = Instance.new("BindableEvent")
BindableEvent.Parent = PropellerNew
local Orientation = Instance.new("NumberValue")
local Functions = {
UpdatePropeller = function(Status)
if Status then
BindableEvent:Fire(Status)
end
end
}
local UpdateVisualEffect = function()
if PropellerNew:FindFirstChildWhichIsA("Motor6D") then
local Motor6D = PropellerNew:FindFirstChildWhichIsA("Motor6D")
Motor6D.C1 = CFrame.new(Motor6D.C1.Position) * CFrame.Angles(0, math.rad(Orientation.Value), 0)
end
end
local Tween = TweenService:Create(Orientation, Info, {Value = 360})
local visualupdate = Orientation:GetPropertyChangedSignal("Value"):Connect(UpdateVisualEffect)
BindableEvent.Event:Connect(function(Status)
if Status:lower() == "landed" then
if Tween.PlaybackState == Enum.PlaybackState.Playing then
Tween:Cancel()
end
Time = 1.15
Info = TweenInfo.new(Time, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1)
Tween = TweenService:Create(Orientation, Info, {Value = 360})
Tween:Play()
elseif Status:lower() == "leaving" then
if Tween.PlaybackState == Enum.PlaybackState.Playing then
Tween:Cancel()
end
Time = 0.6
Info = TweenInfo.new(Time, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1)
Tween = TweenService:Create(Orientation, Info, {Value = 360})
Tween:Play()
elseif Status:lower() == "destroy" then
Tween:Cancel()
visualupdate:Disconnect()
end
end)
return Functions
end
end
return Propeller
well not really because here i set the tween to a new tween
elseif Status:lower() == "leaving" then
if Tween.PlaybackState == Enum.PlaybackState.Playing then
Tween:Cancel()
end
Time = 0.6
Info = TweenInfo.new(Time, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1)
Tween = TweenService:Create(Orientation, Info, {Value = 360})
Tween:Play()
Huh, taking a look at documentation, it looks like Tween:Stop() doesn’t exist? I guess that was just an error on my side. Also you’re checking whether it’s playing, but I’m pretty sure tweens can still be cancelled even if they aren’t playing.
i am not naming the tweens different because this is absolutely useless and messy since i already stop the tween and set the tween global to another tween before playing it.
again this is roblox fault for giving us a completely broken game engine with many broken features.
this shouldn’t be happening at the first place.
and tween:Stop() is not even a real thing.