Touched Not Working

Hi Guys,

I am trying to create a shop that opens when a player steps on a part. However, Touched does not seem to be working at all, and I have spent an hour trying different code to get it working; but still have not gotten anywhere.

This is the code that I am currently using:

local part = script.Parent

local function shopOpen(otherPart)
	local player = game.Players:FindFirstChild(otherPart.Parent.Name)
	if player then
		print("player found")
		player.PlayerGui.Shop.Enabled = true
	end
end

part.Touched:Connect(shopOpen)

You should do:

player.PlayerGui.Shop.Visible = true

instead of Enabled.

I already use GUI for other things in my game, like a player pressing a button to open some GUI.

I used enabled for that and it seems to work just fine.

I believe that I am having an issue with the touched event because not even my prints are working within the code.

It should be a script not a LocalScript

1 Like

Use remote events… Fire client…

Riiiiight,

I complete forgot about Local Scripts not working with Touched.

1 Like

No problem :slight_smile: put me as solution hehe

1 Like

Already got it haha, thanks again!