script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local Gui = player.PlayerGui
Gui.Shop.Shopframe.Visible = true
end
COMMUNITY QUESTION
How do i fix this script, ive tried multiple times but why does it not work?
1 answer
So the problem you might be having is with your if statement. You forgot to end the code block with an “end”.
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local Gui = player.PlayerGui
Gui.Shop.Shopframe.Visible = true
end
By the way, you should use the output for seeing errors, the output will give an error whenever a script fails to execute a task. If the output does not give an error please re-check your code. Giving output errors to a question helps the people helping you understand what’s wrong.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
whats the error?
What Error and what line