Hello!
I have tried to pass a Bool Variable from Client to Server using a RemoteEvent.
However, the server seems to ignore the argument.
This works like that:
Client:
local RED_NAMETAG = false
(Variable)
BUTTON.MouseButton1Click:Connect(function()
if table.find(STAFF_USERNAMES, player.Name) then
if RED_NAMETAG == false then
RED_NAMETAG = true
EVENTEN:FireServer(player, RED_NAMETAG)
elseif RED_NAMETAG == true then
RED_NAMETAG = false
EVENTEN:FireServer(player, RED_NAMETAG)
end
else
player:Kick("You are not allowed to use this feature. Did you see this button by error? Do not hesitate to report a potential bug. Your action has been logged.")
end
end)
And, Server-side:
local function ONSERVER(player, RED_NAMETAG)
if RED_NAMETAG == true then
player.Character.Head:FindFirstChild("NAMETAG").PlayerName.TextColor3 = Color3.new(1, 0, 0.0156863)
elseif RED_NAMETAG == false then
player.Character.Head:FindFirstChild("NAMETAG").PlayerName.TextColor3 = Color3.new(1, 1, 1)
else
error("Variable not found.")
end
end
EVENTEN.OnServerEvent:Connect(ONSERVER)
What exactly happens? Well, the server seems to ignore the argument “RED_NAMETAG”, so the server takes the “else” way (error("Variable not found.")
).
What am I doing wrong ? Can you help me please.
Thank you.