Tween ignores position half the time?

script:

local plrs    = game:GetService("Players")
local plr     = plrs.LocalPlayer
local mouse   = plr:GetMouse()
local tween   = game:GetService("TweenService")

local currentx = 75
local currenty = 75
local pos      = script.Parent.Position
local module   = require(game.ReplicatedStorage.GiveCards)

adb = false
db = false

local function changesize(obj, size)
	local anim = tween:Create(script.Parent, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0), {Size = size})
	return(anim)
end

local rs = game:GetService("RunService")

rs.RenderStepped:Connect(function()
	wait()
	if adb == false and script.Parent.Parent.Name == "PlrButtons" then
		adb = true
		script.Parent.Holder.Position = UDim2.new(0, script.Parent.Holder.Position.X.Offset, 0, script.Parent.Holder.Position.Y.Offset + 200)
		script.Parent.Visible = true
		
		script.Parent.Holder:TweenPosition(UDim2.new(0, script.Parent.Holder.Position.X.Offset, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 0.9)
		script.Parent:TweenSize(UDim2.new(0,75,0,75), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.3)
	end
end)

script.Parent.MouseEnter:Connect(function()
	if db == true then
		return
	end
	local anim = changesize(script.Parent, UDim2.new(0, currentx * 1, 0, currenty * 1.3))
	anim:Play()
end)

script.Parent.MouseLeave:Connect(function()
	if db == true then
		return
	end
	local anim = changesize(script.Parent, UDim2.new(0, currentx * 1, 0, currenty * 1))
	anim:Play()
end)

script.Parent.MouseButton1Click:Connect(function() --issues here
	db = true
	
	script.Parent:TweenSizeAndPosition(UDim2.new(0,0,0,75), UDim2.new(0, script.Parent.Holder.Position.X.Offset, 0, script.Parent.Holder.Position.Y.Offset + 200), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.5)
	task.wait(0.7)
	
	module.shuffle(script.Parent.Parent)
	script.Parent:Destroy()
end)
1 Like

I’m confused. What exactly is the issue? Are you getting any errors? Please use the scripting support format, as there’s not a lot of context with your post and the video has no audio.

as seen on the video the thing I click only goes down half the time, the rest of the time it does not go down and just moves right.

script.Parent.MouseButton1Click:Connect(function()
    db = true
    
    print("Before Tween - Position:", script.Parent.Position, "Size:", script.Parent.Size)
    
    script.Parent:TweenSizeAndPosition(UDim2.new(0,0,0,75), UDim2.new(0, script.Parent.Holder.Position.X.Offset, 0, script.Parent.Holder.Position.Y.Offset + 200), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.5)
    
    task.wait(0.7)
    
    print("After Tween - Position:", script.Parent.Position, "Size:", script.Parent.Size)
    
    module.shuffle(script.Parent.Parent)
    script.Parent:Destroy()
end)

Check the output window in Roblox Studio after running the game to see if the position and size values are changing as expected. If not, you might need to adjust the calculations or troubleshoot further.

Let me know what it outputs.

1 Like

Idk what is happening but try to anchor the part you want to move
Tween service stops when something else except the tween is moving it
The gravity moves the part
The part stops tweening
Edit:ok i watched the video it didnt load cuz im on mobile data
I thought you had a problem with tweening a part

1 Like

Managed to fix it myself (bndjsnfjkdnkjfds)

3 Likes

Even though this is likely case specific, it would still help to share your solution

It was my fault as for some reason not using tweenservice for ui bugs out alot