I am trying to make this GUI open when touching a brick/part and it seems not to work. Any help?
script.Parent.Touched:connect(function() game.StarterGui.Radio1.Enabled = true end)
It's because you're defining the gui on StarterGui, wich replicates it to the player in PlayerGui, so what you should do is create a localscript in the StarterGui and the GUI inside the localscript, a remote event inside replicatedstorage and write this script in the localscript:
local gui = script.YouGuiName local brickTouchedEvent = game.ReplicatedStorage.YouRemoteEventNameHere brickTouchedEvent.OnClientEvent:Connect(function() gui.Enabled = true end)
Then place a normal script inside your part to be touched and write this script:
local brick = script.Parent local brickTouchedEvent = game.ReplicatedStorage.YourRemoteEventNameHere local debounce = false brick.Touched:Connect(function(hit) if not debounce then debounce = true local player = game.Players:GetPlayerFromCharacter(hit.Parent) brickTouchedEvent:FireClient(player) wait(4) debounce = false end end)
I hope this helps!
Hello there! StarterGui is basically like StarterPack, except for GUIs. If you edit a GUI in StarterGui, it only will show up if a new player joins. To fix this, you can do the following:
script.Parent.Touched:connect(function() game.Players.LocalPlayer.PlayerGui.Radio1.Enabled = true end)
If it's a local script, it will work.
Hope this helped!
Before putting this in, make sure you put the GUI in ReplicatedStorage and the script is a LocalScript
local RP = game:GetService("ReplicatedStorage") local gui = RP.Radio1 script.Parent.Touched:Connect(function() gui.Parent = game.Players.LocalPlayer.PlayerGui gui.Visible = true end)
Comment on this answer if it doesn't work, and if you want anything else implemented into this script (if you walk off the brick it gets rid of the GUI, the GUI fade-in, etc.)
Your welcome if it worked,
Narwhal