Hello! So I’m trying to make a Moderation Panel where I can Kick, Ban, Temp Ban, and do announcements. I’m currently working on the Kick option but when I press the button it says the text box is empty.
local Main = script.Parent
local Player = game.Players.LocalPlayer
--// INFO \\--
local BanDuration = Main.BanDuration.Text
local Reason = Main.Kick_BanReason.Text
local Message = Main.Message.Text
local PlayerName = Main.PlayerName.Text
--// MODERATION \\--
local RemotesFolder = game:GetService("ReplicatedStorage").Remotes.ModPannel
local ModButtons = Main.ModButtons
ModButtons.Kick.MouseButton1Click:Connect(function()
--print("Test")
print(Reason, PlayerName)
RemotesFolder.Kick:FireServer(Player.UserId, Reason, PlayerName)
end)
That is because “Reason” variable is never updated after the script runs. The fix is simple, just put the reason variable inside of the click function,
When you declare the “Reason” variable, you are declaring how it is when the game starts. When the game starts, the text is empty. A fix would be to declare the reason as “Main.Kick_BanReason”.
Then when you print the reason:
print(Reason.Text, PlayerName)
print the “reason.text”, which will print what is in the text box at the time of clicking the kick button.