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

May I have help with a gui problem?

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.

1 comment

0

What is a FE?

2 answers

✓ Accepted answer

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)

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)

1 comment

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...

This discussion is preserved as it was. New answers, comments, and votes are closed.