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

Gui doesn't pop upon touch of brick?

Asked by 7 years ago
script.Parent.Touched:Connect(function(HIT)
    local player = game.Players:GetPlayerFromCharacter(HIT.Parent)
    if player == game.Players.LocalPlayer then
        player.PlayerGui.ScreenGui.Shop.Visible = true
    end
end)

script.Parent.TouchEnded:Connect(function(HIT)
    local player = game.Players:GetPlayerFromCharacter(HIT.Parent)
    if player == game.Players.LocalPlayer then
        player.PlayerGui.ScreenGui.Shop.Visible = false
    end
end)

This is in a local script in a brick.

What is wrong here?

0
I have had this problem before too. I just made it a regular script in StarterGui with a player variable and a click detector to make it open. Example:                                         local plr = script.Parent.Parent local click = game.Workspace.ATM.Open.ClickDetector click.MouseClick:connect(function() plr.PlayerGui.ATM.Enabled = true end) PolyyDev 214 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Never use local scripts in parts. Even when It comes to touch events. Use a Server Script (Regular Script) instead.

0
Thank you! I'l remeber to keep that in mind form now on. User#17125 0 — 7y
Ad

Answer this question