Hello, im pocvq or monke according to my display name today i was trying to script a part that makes a shop gui visible when its touched but for some reason my script isnt working and there is no errors or text from it in the output
Here is the script:
local gui = game.StarterGui.Shop.ShopFrame
local plr = game.Players.LocalPlayer
local part = game.Workspace.ActShop
part.Touched:Connect(function(hit)
if hit then
gui.Visible = true
else
warn(“Error”)
end
end
local plr = game.Players.LocalPlayer
local gui = plr.PlayerGui.Shop.ShopFrame
local part = game.Workspace.ActShop
part.Touched:Connect(function(hit)
if hit then
gui.Visible = true
else
warn(“Error”)
end
end)
You have to use a TouchedEvent in a server script inside the part. When the part is touched, it fires a remote event to the player that touched it. When the client receives the message (remote event) it opens the shop Gui. Simply add a close button in the shop gui and your good to go.
As it is on a local script when the part is touched it will connect to that certain player.
If it was in a server script then you had to fire a remote event.
Local scripts can do the work by themselves.