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:
Thermometer with tweening the position:
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?
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?
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.
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.
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