I have a GUI, which kicks a player. When a player is kicked it will provide the reason and who kicked the player, but I get this error. In addition I'm using a RemoteFunction since local scripts cant kick players.
Anyways, I get an error "MouseButton1Down is not a valid member of workspace" why is that?
Script in workspace that contains a remotefunction:
script.RemoteFunction.OnServerInvoke = function(player) Player = game:service'Players'.LocalPlayer script.Parent.MouseButton1Down:connect(function() if script.Parent.Parent.TextBox.Text == "" then else local Reason = game.Players.LocalPlayer.PlayerGui.KickGUI.KickFrame.KickReason local Kicked = game.Players.LocalPlayer.PlayerGui.KickGUI.KickFrame.WhoToKick.TextBox.Text game.Workspace.Players:FindFirstChild(Kicked):Kick("You have been kicked, Reaspn: "..Reason) print(Kicked.." was kicked by "..Player.Name.. " for "..Reason) end end) end
Local script inside the gui:
game.Workspace.Script.RemoteFunction:InvokeServer()
MouseButton1Down is a script for a GUI. MouseClick is the correct usage.