I want open an frame from the ScreenGui by clicking in a Textbutton from an SurfaceGui. However, I’m having trouble with it, I’ve tried using localscript, but it doesn’t even work inside an TextButton.
– ServerScript inside an TextButton
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Protocols = ReplicatedStorage.Event:WaitForChild("Protocols")
local Button = script.Parent
local Event = Protocols.ProtocolFrame
Button.MouseButton1Click:Connect(function()
print("Clicked")
Event:FireClient()
end)
– ServerScript inside an ServerScriptService
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Protocols = ReplicatedStorage.Event:WaitForChild("Protocols")
local teamColors = {
BrickColor.new("Black"),
BrickColor.new("Dark stone grey"),
BrickColor.new("Navy blue"),
BrickColor.new("Really black")
}
local ProtocolFrame = Protocols:FindFirstChild("ProtocolFrame")
ProtocolFrame.OnServerEvent:Connect(function(player)
print("Printed")
local PlayerGui = player.PlayerGui
local PlayerTeam = player.TeamColor
print(PlayerTeam)
for _, Color in pairs(teamColors) do
if PlayerTeam == Color then
print("Passed Test")
local ProService = PlayerGui:WaitForChild("ProtocolService")
ProService.ProtocolFrame.Visible = true
end
end
end)
It shows an error aswell from the first script
15:09:21.909 Argument 1 missing or nil - Servidor - CallEvent:9