BanGUI - Easily punish players!

Yes, time ban is one of the features coming in the next update.

1 Like

PLEASE NOTE

I have been informed that the plugin is sometimes creating the error: OnServerEvent can only be used on the server. The issue is coming from the script, inserted to ServerScriptService to insert the new model. Please do not run the updater yet, as the model will get deleted but not re-inserted. I am working on a fix to this issue.

2 Likes

ISSUE FIXED (MINOR UPDATE)

I have fixed the issue with the plugin, you must update your plugin for it to properly function.

2 Likes

Hello!
What would you say about player history feature?

What do you mean by a player history? Do you mean a list showing users who you have previously taken action on?

1 Like

I think you can achieve that by using Datastore and tables

So I looked at the BanGui and whilst it does work from my testing, some of the scripts need some improvements. I’d provide an rbxm for it, but it would ruin the teachings to learn from this, but once you do read this, you could download it and see all the full changes I did

Polished Ban Gui

Keybind for this one is P
PolishedBanGui.rbxm (16.0 KB)

The first thing I have to mention is the way you set it up so you can set admins to use it. The way it is right now via Attributes is space costly and can be done more effectively, the way I did it was placing IntValues in the Admins folder with the value of it being a UserId of a player you want to admin, and in the scripts that need to check the ids, just make a table and put every UserId in the folder in the, this effectively makes it so you can have as many admins as you want and since it’ll be done on Server start up, no one can cheat the system to have free admin

From what I could tell, you don’t need to have separate local scripts for each of the actions you can take on a user (Ban, Kick, etc), You can just look through all the action frames, if the child is a Textbutton, do universal code there instead of separate localscripts. The way I did it was this

local nameBox = script.Parent.Parent.playerName.Front.Input
local reasonBox = script.Parent.Parent.reason.Front.Input

local repStore = game:GetService("ReplicatedStorage")

for _,button in pairs(script.Parent:GetDescendants()) do
	if button.ClassName ~= "TextButton" then continue end
	
	local buttonType = string.gsub(button.Parent.Name, "Button", "") --Removes Button from frame name
	local text = button.Parent.Front.TextLabel
	
	button.MouseButton1Click:Connect(function()
		local name = nameBox.Text
		local reason = reasonBox.Text
		
		if name == "" or reason == "" then
			text.Text = "Missing arguments"
			wait(2)
			text.Text = buttonType:upper()
		else
			print("Sending to ".. repStore[buttonType].Name)
			repStore[buttonType]:FireServer(name,reason)
		end
	end)
end

This localscript was placed as a Child of FloatingButtons. What this does is simple

  • Loop through all the descendants and ignore non TextButtons
  • Get the type of button it is by removing Button from the name of its parent, BanButton becomes Ban with this for example, so we know what type of button this is
  • Connect an event so when the button is clicked, it gets the text of PlayerName and Reason, checks if either of them is empty and if they aren’t, fire the corresponding RemoteEvent relating to the type of button is it

I did have to change the names of some of the remoteevents to get this working, and removed the localscripts form the action buttons, but all in all, it did make it a bit less repetitive which is always nice

The final thing I fixed up was the Warn Tween you had going. It isn’t really performant to use a while true do loop in you case as you could just use GetPropertyChangedSignal on the Visible property and do nothing if it’s false instead of waiting for it to be true.

Also numerical for loops exist which would help reduce the amount of repetition for the count down till the warn gui goes away.

And the final argument of TweenSizeAndPosition is callback, which is basically a function to run when the tween has finished, it removes the second unneeded busy wait that waits for the separator to be a certain size and position.

At the end after those changes, that script became this:

local main = script.Parent.Parent.Parent

main:GetPropertyChangedSignal("Visible"):Connect(function()
	if not main.Visible then return end
	for i = -1, -11, -1 do
		wait(1)
		script.Parent:TweenPosition(
			UDim2.new(0,0,i,0),           -- Final position the tween should reach
			Enum.EasingDirection.In, -- Direction of the easing
			Enum.EasingStyle.Sine,   -- Kind of easing to apply
			0.125,                       -- Duration of the tween in seconds
			true                    -- Whether in-progress tweens are interrupted
		)
	end

	main.Separator:TweenSizeAndPosition(
		UDim2.new(0,0,0,2),
		UDim2.new(0.5,0,0.3,0),
		Enum.EasingDirection.Out,
		Enum.EasingStyle.Quad,
		1,
		true,
		function(state)
			main.Visible = false
		end
	)
end)

That’s all I honestly have to say, everything else was okay from my perspective. There are a few things I would recommend

  • Adding checks to make sure you cannot give an action to yourself (can’t ban yourself for example)
  • Making it so you don’t have to be completely correct with the name down to the capitalization. Basically, try adding something that will still punish a player regardless if you forgot to capitalize something. Example, writing embathehybrid should still work as if you wrote EmbatTheHybrid
  • Perhaps, but I’m not sure if this would fit with your gui, maybe also add punish by UserId as well?
1 Like

Thank you for all of those tips, I will use them and probably update the current model to the polished one :wink:

What do you mean by this?

1 Like

What I meant by that was, if possible, also be able to punish someone using their UserId as well.

Say you wanted to Warn ROBLOX for doing something bad in your game, you could either write ROBLOX, or you could write his UserId, 1 to be able to punish him.

Basically, what I meant by that was to maybe also allow Admins to write a UserId to punish someone as well. This is probably not gonna be that well of an addition considering Username already fills up the Textbox quite a lot

1 Like

That seems like a useful feature, I will add that to the planned features!

2 Likes

Alright! Besides the things I mentioned and the additions you could make that I mentioned at the end, which would honestly improve the use of your Ban Gui, Punish by userid, allow any typing of a Username to count and not allowing an admin to punish themselves, your Gui is quite simple to understand how to use, keep up the good work! If I ever see anything else that would need improvements, I’ll let ya know!

Also I’m not sure if this is just me or I just pressed the wrong button, but BackSlash wasn’t working for me so I had to rebind it to P

Sorry for the lack of updates recently, I’m working on a complete UI redesign along with compatibility for the EZban warn, the features from the polls, and the custom modules.

2 Likes

You should make it so when you’re typing something in the chat and you press your GUI open key it won’t open :smirk:

1 Like

Is there support for mobile users?

Not yet, but I have been planning that for a while and it is coming out soon!

3 Likes

Hey question what is the keybind to open the panel

I dont really trust these sort of things, unless they’re 100% safe and trusted by the community. This is why I would only use Kohls admin, or make my own panel. Nonetheless, your creation is really cool, so keep up the good work!

The default keybind is backslash ( \ ) , but it is configurable as listed in the docs.

1 Like

POLL:

I am adding tons of new customization features to BanGUI. Vote on them below!

Would you be willing to allow BanGUI to send punishment data to a private Discord server that is not affiliated with your game? (Used for other people to read to potentially ban the same exploiter in their game)
  • Yes
  • No

0 voters

Would you enable weekly/monthly ban summaries (would send to a discord server)?
  • Yes
  • No

0 voters

Would you enable ban history?
  • Yes
  • No

0 voters

Would you enable a feature that allows Roblox administrators to have access to the ban panel?
  • Yes
  • No

0 voters

I am going to periodically update this poll, keep checking!

1 Like

Major Update 2.0.0 is on the way!

Due to the large update that 2.0.0 is, the update will be coming out in two parts: 2.0.0.A, and 2.0.0.B.

What is the general update going to be?

2.0.0.A will be focusing on the UI.

2.0.0.B will be focusing on the customization.

What are the specific things being added to each update?

2.0.0.A features
  • Major UI redesign
  • Mobile and console “open menu” button
  • Autocomplete options for user, reason, and time
2.0.0.B features
  • Configuration options (vote on some above!)
  • Custom modules and other planned features
  • A module system that allows for using BanGUI functions in a script
  • And more…
1 Like