Local script in button:
script.Parent.MouseButton1Click:Connect(function() game.ReplicatedStorage.FEevents.BanPlayer:FireServer() end)
Server script in button:
game.ReplicatedStorage.FEevents.BanPlayer.OnServerEvent:Connect(function(player) local bayun = Instance.new("BoolValue") bayun.Name = script.Parent.Parent.BANPLAYERHOLDER.Text bayun.Value = true bayun.Parent = game.Workspace.BanishedPlayers.Banned game.Players:FindFirstChild(script.Parent.Parent.BANPLAYERHOLDER.Text):Kick("You have been BANNED for: "..script.Parent.Parent.BANPLAYERReason.Text) end)
The FEevent BanPlayer is a RemoteEvent, should it be a different event?
Please mark my answer as the solution :D
Local script:
local ban = game.ReplicatedStorage.BanPlayer--RemoteEvent variable. script.Parent.MouseButton1Click:Connect(function() local bp = script.Parent.Parent.BANPLAYERHOLDER.Text -- Gui.who is being banned. local br = script.Parent.Parent.BANPLAYERReason.Text -- Gui.For what reason they are being banned. ban:FireServer(bp ,br) -- Fires with parameter ( player, arg, arg2 ), where player is automatically parsed,arg1 is the banned player,arg2 is the reason to ban player. end) ban.OnClientEvent:connect(function(arg, arg2)--Listener of FireClient(),just an example. print(arg, arg2) end)
Server script:
local ban = game.ReplicatedStorage.BanPlayer-- Declare variables outside of functions. ban.OnServerEvent:Connect(function(player,arg,arg2) -- Parse arguments player, and variants. local bayun = Instance.new("BoolValue") -- Created BoolValue. bayun.Name = arg -- BoolValue.Name = arg(Player who is being banned) bayun.Value = true -- Ban = true bayun.Parent = game.Workspace.BanishedPlayers.Banned -- Creates a boolvalue in BanishedPlayers.Banned print(player, arg, arg2) -- Prints. game.Players:FindFirstChild(arg):Kick("You have been BANNED for: " .. arg2)-- arg is the banned player's name and arg2 is the reason to ban player. local h = Instance.new("Hint") -- A Hint to show the server who has been banned and for what reason. h.Text = (arg.." has been kicked because of : "..arg2)--Hint.Text ( simple ). h.Parent = workspace wait(2) h.Parent = nil --Destroys Hint. ban:FireClient(player, arg,arg2) -- Explains how a FireClient() works. end) -- Do not forget to end functions and loops appropriately.
EDIT : To get more assistance can I get a screenshot of the hierarchical order of your game explorer.