Hey, can someone tell me why my console isn't working?

Hey, everyone! I’m currently making a game called “LA World” and I don’t want to have adonis or khols or whatever people use for admin these days.

I’m trying to make my own admin console but I’ve been having some trouble with the kick function. Could someone help me fix my code and allow me to kick people? Thanks!

I’ll leave some images below.

Scripts


Errors

Workspace

image
image

Thanks if you can help, ask me if you need any more screenshots of anything.

First of all, you shouldn’t be using a remote to kick players, this makes your game vulnerable to exploiters, second, it errors because you don’t use :WaitForChild(). The script hasn’t finished loading in the GuiObjects therefore they are nil when you attempt to cache them in a variable.

1 Like

In your local script, you are passing a parameter Player, which is not a valid parameter. The event MouseButton1Click takes in x coordinate, and a y coordinate parameters.

That’s not what I’m asking, my script doesn’t work.

We’re telling you why it doesn’t work man…

What do I set this to then?
image

Part of what makes your script not functional is your invalid parameters. You are basically giving a 2D coordinate a property Text, which is not valid. You don’t need any parameters for a MouseButton1Click event in your case. Along with what @JustNode said, it’s also good practice to use :WaitForChild for UI elements because everything in the StarterGui replicates to the client, and this process is not automatic, so your program will run without these UI elements being loaded into the game yet

I set that to nothing, still doesn’t work at all. I also changed the script from local Player = blah to local PunishPlayer = balh but nothing still happens

You need to use :WaitForChild() on your GuiObjects so the script yields itself till everything has loaded in.

image

The objects you’re passing are nil.

What do you mean by that? I don’t get what you are saying.

“PunishPlayer.Text” is not a player, it is a property and therefore it doesn’t have a Name property. It errors because in the script on the server, you’re trying to do PunishPlayer.Text.Name.

I didn’t give it a name property.

What…? Please read how remotes work on the developer hub or a youtube tutorial. I’ve told you why your code doesn’t work.

1 Like

I’m such an idiot. Sorry for wasting your time I found it.

:+1: Alrighty, sounds good. Have a nice day.

1 Like