Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Touched event to open/close GUI not working in game?

Asked by
trecept 367 Moderation Voter
6 years ago
game.Workspace["Shop"]:WaitForChild("buy").Touched:connect(function(player)
    if player.Parent:FindFirstChild("Humanoid") then
        local playername = game:GetService("Players"):FindFirstChild(player.Parent.Name)
        if playername.PlayerGui:FindFirstChild("shop").Frame.Visible == false and playername.PlayerGui:FindFirstChild("AnimShop").Frame.Visible == false then
            playername.PlayerGui:FindFirstChild("shop").Frame.Visible = true
        end
    end
end)

This script is supposed to make the gui visible when a player touches a brick called "buy". It works perfectly in studio but not in game. How can I fix this?

0
put it into a local script caipira 29 — 6y
0
i tried to put it in a localscript but it wasn't working? trecept 367 — 6y

Answer this question