TweenService not tweening the position

Hello! I am trying to make a thermometer where if you touch a part, the red part of it drops!
However, the script I am using seems to not be working for some reason, as the size is tweening correctly but not the position.

Thermometer without tweening the position:
Screenshot 2024-12-15 224112

Thermometer with tweening the position:
Screenshot 2024-12-15 224221

local db = false

game.Workspace.ColdRoom.Touched:Connect(function()
	if not db then
		db = true
		ts:Create(script.Parent, TweenInfo.new(2.5), {Size = Vector3.new(0.461, 0.052, 0.052), Position = Vector3.new(script.Parent.Position.X, script.Parent.Position.Y - 0.2, script.Parent.Position.Z)}):Play()
	end
end)

Is there an easier way that I should be doing this?

i don’t see the difference in both pictures or i could just be missing something, can you explain further?

1 Like

They’re both the same but the one with the position tweening is meant to be touching the red circle!

1 Like

increase the 0.2 a bit and see

I changed it to -1 and it looks like this still
Screenshot 2024-12-15 231743

my brain is kinda slow right now but if i were you i would try experimenting a bit more like incrementing that value to something really high, have you even checked if .Touched is fired?

1 Like

yes .Touched is fired because the size is tweened too.
This before i touch it
Screenshot 2024-12-15 232215
-100 does nothing too sad

doing a bit research my tiny brain still can’t find the problem, but try CFrame = part.CFrame - Vector3.new(0, 0.2, 0)

Uhm… strange.
Try this:

local tweenService = game:GetService("TweenService")
local instanceToTween = path.to.instance
local tweenGoal = {instanceToTween.Position.X, instanceToTween.Position.Y - 0.2, instanceToTween.Position.Z}
local touchPart: Part = path.to.part

local debounce = false

local setDebounceFalseWithTimeout = function(t)
	if not debounce then return end
	
	task.wait(t)
	
	debounce = false
	
	return
end

touchPart.Touched:Connect(function()
	if not debounce then
		debounce = true
		--do the tween
		setDebounceFalseWithTimeout(2)
	end
end)

This is not tested but if it does not work try with CFrames.

1 Like

still dikkdnt work sadly :frowning: thanks for the help though

Does script.Parent actually have a Position?

The size works because you are setting a specific size. As far as I’m aware, if the script.Parent doesn’t have a Position, it doesn’t know what to set the position to.

yes it does it is a union so yeah

Can you send me a file of the thermometer and the script?

Could the red part be welded? I’m pretty sure welded parts can not have their position tweened.

2 Likes

oh thgey cant? do you know what i should do instead?

If you can’t disable the weld and just anchor the part, then you would have to tween the C0 property of the weld. C0 is essentially the offset from the Part0’s cframe that gets applied to the Part1