I’ve been using YouTube and brainstorming how I can make a script that opens a GUI when a part is clicked, however, I just can’t figure it out. Any help?
Thanks!
I’ve been using YouTube and brainstorming how I can make a script that opens a GUI when a part is clicked, however, I just can’t figure it out. Any help?
Thanks!
Put a click detector in the part and make a script that gets your mouse input and when you click it using that click detector it will access the playergui to open the gui
Have a click detector inside of your part
Then with a local script Try something like this
local clickdetector = game.Workspace.Part.ClickDetector
clickdetector.MouseClick:Connect(function()
script.Parent.YourGui.Visible = true
end
Hey! In the part, you need a ClickDetector
and a regular Script.
local clickdetector = script.parent.ClickDetector
clickdetector.MouseClick:Connect(function(plr)
plr.PlayerGui:FindFirstChild("GUI_NAME").Enabled = true
end)
Put a click detector in the part, and a remoteevent in replicatedstorage
Script inside part:
local cd = script.Parent.ClickDetector
local rs = game.ReplicatedStorage
cd.MouseClick:Connect(function()
rs.RemoteEvent:FireClient() --Add args if you want
end)
LocalScript in StarterGui
local rs = game.ReplicatedStorage
rs.RemoteEvent.OnClientEvent:Connect(function()
script.Parent.Visible = true
end)
Should the GUI be in the part?
No, it should be StarterGui, and the LocalScript should be inside of the frame that is being shown
found my mistake, go into the script and do this:
cd.MouseClick:Connect(function(Player)
rs.RemoteEvent:FireClient(Player)
and in the localscript:
rs.RemoteEvent.OnClientEvent:Connect(function(Player)
can you send the whole thing corrected now?
Frame/ scroll frame/ buttons/ labels:
Change .Enabled
to .Visible
Script:
change .Enabled
to .Disabled
can you show us what gui your trying to open?
like that? so i can know if your trying to open is Script instead of GuiBase.
I see your problem, replace
plr.PlayerGui:FindFirstChild("RecruitmentComputerGUI").Enabled = true
to
script.Parent.RecruitmentComputerGUI.Parent = plr.PlayerGui
oh sorry lol
try changing
.RecruitmentComputerGUI
to
:FindFirstChild("RecruitmentComputerGUI")
or
:WaitForChild("RecruitmentComputerGUI", 24)
also i see that your trying to move the UI,
do you want to use :Clone()
function instead?
Can I just message you via Discord? It’d be so much easier.