What I’m trying to do is, whenever someone clicks on a UI button I made, a ScreenGui’s descendants which is just frames and text buttons, become visible to the team “Lobby.” I was just wondering if anyone can help me with how I should script it because I tried many ways and it doesn’t work.
Make a RemoteEvent
named ToggleUI and place it under ReplicatedStorage
. Then in the LocalScript
which detects when the gui is clicked, do:
local ScreenGui = PlayerGUI.CaptainList
local UIButton = PlayerGUI.UIButton -- the button which will toggle the gui
local ToggleUIEvent = ReplicatedStorage.ToggleUI
UIButton.MouseButtonClick:Connect(function()
ToggleUIEvent:FireAllClients()
end)
ToggleUIEvent.OnClientEvent:Connect(function()
for _, descendant in CaptainList:GetDescendants() do
descendant.Visible = true
end
end)
You can also filter out the player who’s firing the event for quicker response.
1 Like
My apologies I’m just a bit confused, the local script should go into the ui button?
Just put it wherever you want (i prefer StarterPlayerScripts but thats just me), but just make sure you adjust the references accordingly.
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.