I am having an issue that i cant figure out

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.

Module script:

client script to handle the status:

and the server part that fires the remote event (it always work)

image

if anyone could help i would appreciate it

1 Like

hey OP im having a hard time to read the first image can u just copy and put it like this pls

local blabla = game.workplace
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

here it is

The probleme maybe caused cuz of the same variable name for the tween ? try to change like:
Tween1, Tween2

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()

I was talking bout this line
Capture

and sorry if my line is not a line its hard on mouse

just try it and if its not working ill keep searching for the error

yeah ive removed the first tween referencing and same for info and it stills plays two tweens at once

so were going to do my debug way is find the erroned function and add a print statemet between each line
E.g. :

function ErronedFunction()
   print("1")
   -- some code
   print("2")
  -- keep going till the last line unless these a return
end

what makes you prefer Tween:Cancel() over Tween:Stop()? The tween can still be replayed.

i dont want to play the same tween i want to play a different tween

then you can use Tween:Stop() instead. Also, I’d definetly just consider naming the tweens differently instead of always creating a new tween object.

Do you mean the animation is choppy? I don’t really understand what you mean by “playing two tweens at once”

i think she meant like these 2 animation shouldnt be played together

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.

tweens can infact be stopped but i dont understand why it is NOT stopping for me

My issue is that roblox doesnt even let us change the time of a tween while its running.

another proof that they extremely out of touch with their community

the tween is infact the same all i want is just to have the time shorter since its a helicopter propeller

Maybe try removing this if statement and directly doing Tween:Cancel()

1 Like