My mesh wont Tween

So my script (Not a local script) is in a GUI frame. I’m trying to Tween a mesh part and when press the GUI button it does nothing.

  • The last output is in line 9 when I press the button
My Script
--Locals--
local Door = game.Workspace:WaitForChild("FrontDoor")
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out)
local TweenClosed = TweenService:Create(Door, tweenInfo, {Position = Vector3.new(482.308, 61.995, -473.264)})
local TweenOpen = TweenService:Create(Door, tweenInfo, {Position = Vector3.new(482.308, 42.813, -473.264)})
--
script.Parent.MouseButton1Click:Connect(function()
	print("lockdown") -- Right here is the last output I get from the script

TweenClosed:Play()
	wait(5)
	TweenClosed:Pause()
	print("Tween Closed done")
	--
	wait(60)
	-- 
	TweenOpen:Play()
	wait(5)
	TweenOpen:Pause()
	print("Tween Open done")
	
end)

-- Door open Vector3 482.308, 61.995, -473.264
-- Door closed Vector3 482.308, 42.813, -473.264

Your main issue is that you’re using a script inside of a Gui frame. In order to hear clicked events from UI objects you need to use a LocalScript. Another problem is you have the script inside of a Frame. Instead, you should put the script inside of either a TextButton or an ImageButton.

1 Like

Thank you! I forgot to say that I is in a TextButton! oops

1 Like