Touched only works once

experiment - Roblox Studio (gyazo.com)

so as you can see, it brings up the purchase menu the first time, but never after that.

here’s the code.

script.Parent.GatePart.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if game.Players[hit.Parent.Name].Areas.HillOne.Value == false then
    		local Gui = script.Parent.BuyArea:Clone()
    		Gui.Parent = game.Players[hit.Parent.Name].PlayerGui
    	end
	end
end)

I believe it’s because the script is still detecting a “BuyArea” Gui, even after there isn’t one. I think this because there is two buy areas, ]you can touch one of them, and neither of them will work after.

by the way, if you press no on the gui when it comes up, it just deletes the gui from the player.

I think it’s because you’re pressing no on the client so the server still thinks there’s a ui there. You should reference the part from a localscript inside of starterplayerscripts or inside of the UI.

1 Like

that makes a lot of sense, thank you.

1 Like