So after realizing that you cannot use LocalPlayer inside of a normal script, I don't know how to go about doing this. Basically what this script is supposed to do is this: -A player touches a certain part/brick -A store gui which is located inside the player's PlayerGui opens (ShopGui1.Frame.Visible = true) -If the player stops touching the part, the gui closes (ShopGui1.Frame.Visible = false) This is what I had:
--Opens the store gui
function onTouch(hit)
local human = hit.Parent:FindFirstChild("Humanoid")
if human then
game.Players.LocalPlayer.PlayerGui.ShopGui1.Frame.Visible = true
script.Parent.TouchEnded:connect(endTouch)
end
end
--Closes the store gui
function endTouch()
game.Players.LocalPlayer.PlayerGui.ShopGui1.Frame.Visible = false
end
script.Parent.Touched:connect(onTouch)

2 comments
It worked, thanks!
No problem.