Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i fix this script, ive tried multiple times but why does it not work?

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 

2 comments

0

whats the error?

0

What Error and what line

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.