Tween Is Acting Weird

Hey! I have a bit of a problem with my script. I have a script to first raise an object’s position, then drop it to it’s original form. Problem is, whenever I try it out, it goes down instead of up. I tried switching the - with a + and vice versa, but it still doesn’t work as intended. I think it’s a result of the modulescript I wrote to streamline processes like this, but I’m not sure.

Script(parented to part inside Workspace):

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PlatformTweenModule = require(ReplicatedStorage.Modules.PlatformTweenModule)

while true do
	
	PlatformTweenModule.PhysicalTween(script.Parent, 4, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, script.Parent.Position - Vector3.new(0, 10, 0))
	print("up")
	wait(15)
	
	PlatformTweenModule.PhysicalTween(script.Parent, 4, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, script.Parent.Position + Vector3.new(0, 10, 0))
	print("down")
	wait(15)
end

ModuleScript(ReplicatedStorage):

local PlatformTweenModule = {}
local TweenService = game:GetService("TweenService")

function PlatformTweenModule.PhysicalTween(part: Part, time: number, EasingStyle: Enum.EasingStyle, EasingDirection: Enum.EasingDirection, repeatCount: number, goal)
	local info = TweenInfo.new(time, EasingStyle, EasingDirection, repeatCount)
	local tweenInQuestion
	if typeof(goal) == "Vector3" then
		tweenInQuestion = TweenService:Create(part, info, {Position = goal})
	elseif typeof(goal) == "number" then
		tweenInQuestion = TweenService:Create(part, info, {Transparency = goal})
	end
	
	tweenInQuestion:Play()
	
	wait(time+1)
	
	tweenInQuestion:Cancel()
	
end

return PlatformTweenModule

Any help at all would be greatly appreciated. Thank you!

1 Like

Does it go down in the first, second or both tween ?
EDIT: I copied the scripts and looks fine to me, tha part goes down then goes up to the original position.

1 Like

Well I fixed it so it doesn’t matter, but the goal was for it to go up and then down, but it’s fixed now so don’t worry. Thanks for your time though!

1 Like