Still have questions? Join our Discord server and get real time help.
1

# May I have help with a gui problem?

Asked by 5 years ago

So I'm trying to make a bank robbery simulation, but I'm somehow having trouble with popping up the gui when you touch a brick. I'll make it close later in time but I just want it to open right now. Here is the code

workspace.RobBank.Touched:connect(function()
game.StarterGui.ScreenGui.MainRobbery.Visible = true
end)


There are no errors, I don't know what's wrong.

This might be a simple fix, but I can't catch it. Can one of you help?

Thanks.

0
What is a FE? DeveloperSolo 355 — 5y

1
Bluseph 35
5 years ago

What I did was I put a script in the RobBank part, then wrote this in the script, when I tried it in studio myself it worked. Hopefully this helps.

script.Parent.Touched:connect(function()
game.Players.LocalPlayer.PlayerGui.ScreenGui.MainRobbery.Visible = true
end)


1
Answered by 5 years ago

Modifying StarterGui doesn't change anything. You have to modify the within the player object (the one in game.Players)

You can do this to solve your problem:

[Must be in a LocalScript]

local player = game.Players.LocalPlayer

script.Parent.Touched:connect(function()
player.PlayerGui.ScreenGui.MainRobbery.Visible = true
end)

0
lol two questions concerning basically the same thing, yea i think he needs to use PlayerGui instead of StarterGui, and he will have to do it to all the players in this case... dragonkeeper467 453 — 5y