Tween won't play when part is touched

I want to make this tween play when the TweenActivator part is touched.

The problem is that the tween doesn’t play when the TweenActivator is touched.

Later on, I found a misspelling in the script. I corrected it but it still doesn’t work.

Script:

local tweenService = game:GetService("TweenService")

local object = script.Parent

local tweenInfo = TweenInfo.new(
	6, 
	Enum.EasingStyle.Quad,
	Enum.EasingDirection.Out, 
	0,
	false, 
	0 
)

local properties = {
	Position = Vector3.new(-316.18, 0.5, -197.76)
}

local tween = tweenService:Create(object, tweenInfo, properties)

game.Workspace.TweenActivator.Touched:Connect(function(touched)
	tween:Play()
end)

What’s the problem here?

1 Like

Are you sure, this is the right path?
game.Workspace.TweenActivator

No errors in output?

Maybe try this to ensure it only triggers once per touch:

game.Workspace:WaitForChild("TweenActivator").Touched:Connect(function(touched)
	if touched.Parent:FindFirstChild("Humanoid") and db then
		warn("touched", touched)
		db = false
		tween:Play()
		task.delay(2, function() db = true end)
	end
end)

Read the output

1 Like

Should it only play the tween when touched by a player?

1 Like

Verify these :

  1. Make sure the object you are viewing the object which you want to twin.
  2. Make sure the original position of the object is not the same as the position you want the object to go in a tween version.
  3. Make sure the tweenActivator can be touched. (CanTouch set to true)
1 Like