This is my code:

local Origin = script.Parent
local Enabled = true
local Gui = game.ReplicatedStorage:WaitForChild("ShopGui")

Origin.TouchedEnded:Connect(function(Hit)
	print("Touch ended!")
	if Hit.Parent and Hit.Parent.Humanoid and Hit.Parent.HumanoidRootPart and 			Hit.Parent.Humanoid.Health > 0 then
		local Char = Hit.Parent
		local Plr = game.Players:GetPlayerFromCharacter(Char)
		local Root = Char.HumanoidRootPart
		if Plr.PlayerGui:FindFirstChild("ShopGui") ~= nil and Enabled == true then
			Enabled = false
			GuiC.Item_Menu:TweenSize(UDim2.new(0, 0, 0, 0), "Out", "Sine", 0.3)
			GuiC.Item_Menu:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "Out", "Sine", 0.3)
			GuiC.Shop_Menu:TweenSize(UDim2.new(0.005, 0, 0.005, 0), "Out", "Sine", 0.3)
			GuiC.Shop_Menu:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "Out", "Sine", 0.3)
			wait(0.31)
			GuiC:Destroy()
			Enabled = true
		end
	end
end)

Whenever the part is touched, it works, but once the touch ends, it doesn't even print the first line. Is touch ended depreciated? If it is, what else could I use to do the same thing?

2 comments

1

TouchEnded is not depreciated.

0

Why isn't it working?