Hello scripters, I have a remote function that triggers a screen GUI to pop up when a brick is clicked. In return, the GUI has a button, theoretically what I want to do is send a bool value back to the remote function if the person clicks the GUI button. Any thoughts ideas? (I'm trying not to clutter my place with multiple remote events/functions)
I am pretty new to using remote events/functions just as a side note, so please excuse the scripting.
Server script:
local Mainevent= Instance.new("RemoteFunction")
Mainevent.Parent = workspace
Mainevent.Name = "Acceptance"
local clickDetector = Instance.new("ClickDetector")
clickDetector.Parent = game.workspace.eventpart
clickDetector.MouseClick:connect(function(player)
if not game.workspace.Events:FindFirstChild('Event') then
local fold = Instance.new("Folder",game.Workspace.Events)
fold.Name = "Event"
for i,v in pairs(game.Players:GetChildren()) do
wait()
event:InvokeClient(v)
end
end
end)
function workspace.Acceptance.OnServerInvoke(player, bool)
if bool== true then
print("True")
end
end
Client Script:
function workspace.Acceptance.OnClientInvoke()
game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = true
print("EventHappened")
end
function yes()
return true
end
game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.TextButton.MouseButton1Down:connect(yes)

1 comment
Tip 2 also means the first waitforchild in a script means you no longer have to use waitforchild on the same instance again