Admin gui not working

Hi, I’m trying to create a simple admin gui to troll my friends with.

My script is not working, i’m pretty new to this and I’m sure there is a big error somewhere. Yet it does not give me any error message.

Script:

script.Parent.Enter.MouseButton1Click:Connect(function()
	local user = script.Parent.Username
	local power = script.Parent.Power
	local speed = script.Parent.Speed
	
	if user.Text then
		checkPlayer(user.Text)
	else
		return
	end
	
	local player = game.Players[user.Text]
	local char = player.Character
	local humanoid = char:WaitForChild("Humanoid")
	
	if power.Text then
		if typeof(power.Text) == "number" then
			char:FindFirstChild("Power").Value = power.Text
		end
	else
		char:FindFirstChild("Power").Value = char:FindFirstChild("Power")
	end
	
	if speed.Text then
		if typeof(speed.Text) == "number" then
			humanoid.WalkSpeed = speed.Text
		end
	else
		humanoid.WalkSpeed = humanoid.WalkSpeed
	end
end)

Yes, there is an undefined function. I have added a function to it somewhere above this part, the function works fine.

2 Likes

Where is your script located? And what kind of one is it local or server?

1 Like

Usually, I’d try my best to help you without any sort of additional information. However, studio is down for me, and such I need you to run print statements to find out which functions are running, and which aren’t. If it gets to the point where nothing is printing, even when functions you know should be working are called, you need to relocate your script. Also, you should consider using RemoteEvents/Functions and BindableEvents/Functions. I’m aware that this is meant to be a joke for your friends, but it really is a good habit to get into. I’m assuming this is a server script, so having a client’s GUI connect directly to a server script is severely inefficient.

Could you post your entire script? Also, what type of script is this?

Oh, it’s in a localscript. That’s the issue.

Dumb me, thanks for helping though. You helped me to find the issue.

Don’t use local scripts when detecting if the player is an admin. It can get exploited

How would I do this in a server script?

I can’t post code properly rn sorry I’m on mobile.

But my solution is remote event
RemoteEvents will be the functions that are waiting to be fired
When a RemotrEvent is fired the script checks if the player is an admin then it does the rest