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

How to display GUI when clicking on brick?

Asked by
Paradoa 17
4 years ago

I inserted a local script in the brick. Am I supposed to use a normal script? I also used the code in the normal script and it doesn't work either.

local dialogue = game.StarterGui.Dialogue1

script.Parent.ClickDetector.MouseClick:Connect(function()
    wait(1)
    dialogue.T1.Visible = true
    wait(3)
    dialogue.T1.Visible = false
    wait(1)
    dialogue.T2.Visible = true
    wait(3)
    dialogue.T2.Visible = false
end)

2 answers

Log in to vote
0
Answered by
hallmk7 50
4 years ago

For this you have to use remote event. Note that it should be a client event.

First Part: Make a normal script parented to part in workspace.

local CD = script.Parent.ClickDetector
local toggle = false

CD.MouseClick:Connect(function(player)
    if toggle == false then
        toggle = true
        game.ReplicatedStorage.RemoteEvent:FireClient(player, toggle)
    elseif toggle == true then
        toggle = false
        game.ReplicatedStorage.RemoteEvent:FireClient(player, toggle)

    end



end)

Now Second Part: Make a local script parented to ScreenGui in StarterGui.

game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(toggle)
    if toggle == true then
        script.Parent.Frame.Visible = true

    else
        script.Parent.Frame.Visible = false

    end


end)

Hope this works for you as it is doing for me!

0
it says RemoteEvent is not a valid member of ReplicatedStorage Paradoa 17 — 4y
0
so u have to insert a RemoteEvent in ReplicatedStorage hallmk7 50 — 4y
0
oh Paradoa 17 — 4y
Ad
Log in to vote
0
Answered by
Borrahh 265 Moderation Voter
4 years ago

Local Script

local dialogue = game.Players.LocalPlayer.PlayerGui. Dialogue1

script.Parent.ClickDetector.MouseClick:Connect(function()
    wait(1)
    dialogue.T1.Visible = true
    wait(3)
    dialogue.T1.Visible = false
    wait(1)
    dialogue.T2.Visible = true
    wait(3)
    dialogue.T2.Visible = false
end)
0
Doesn't work Paradoa 17 — 4y

Answer this question