Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I make a ban script using datastore?

I am trying to make an admin panel but I cant find a way to make a ban script



G_1_ = script.Parent.ScrollingFrame
local L_1_ = "Nothing"

G_1_.Ban.MouseButton1Click:Connect(function()
	L_1_ = "Ban"
	G_1_.Ban.TextColor3 = Color3.fromRGB(85, 255, 0)
	G_1_.Kick.TextColor3 = Color3.fromRGB(170, 170, 170)
	G_1_.Warn.TextColor3 = Color3.fromRGB(170, 170, 170)
end)

G_1_.Kick.MouseButton1Click:Connect(function()
	L_1_ = "Kick"
	G_1_.Ban.TextColor3 = Color3.fromRGB(170, 170, 170)
	G_1_.Kick.TextColor3 = Color3.fromRGB(85, 255, 0)
	G_1_.Warn.TextColor3 = Color3.fromRGB(170, 170, 170)
end)

G_1_.Warn.MouseButton1Click:Connect(function()
	L_1_ = "Warn"
	G_1_.Ban.TextColor3 = Color3.fromRGB(170, 170, 170)
	G_1_.Kick.TextColor3 = Color3.fromRGB(170, 170, 170)
	G_1_.Warn.TextColor3 = Color3.fromRGB(85, 255, 0)
end)

-----

G_1_.Confirm.MouseButton1Click:connect(function()
	if L_1_ == "Nothing" then
		G_1_.Error.Text = "Action requred!"
		G_1_.Error.TextTransparency = 0
		wait(3)
		G_1_.Error.TextTransparency = 1
	end
	local L_2_ = tostring(G_1_.Player.Text)
	local L_3_ = tostring(script.Parent.Parent.Parent.Parent.Name)
	local L_4_ = tostring(G_1_.Reason.Text)
	if L_4_ == "" or L_4_ == " " then
		G_1_.Error.Text = "Reason requred!"
		G_1_.Error.TextTransparency = 0
		wait(3)
		G_1_.Error.TextTransparency = 1
	end
	local L_5_ = G_1_.Error
	local L_6_ = game.Players
	if L_1_ == "Kick" or L_1_ == "Ban" then
		if not L_6_:FindFirstChild(L_2_) then
			L_5_.TextTransparency = 0
			L_5_.TextStrokeTransparency = .5
			L_5_.Text = "Player not found!"
		else
			if L_1_ == "Kick" then
				local L_7_ = L_6_:FindFirstChild(L_2_)
				L_7_:Kick("Kicked | You have been kicked by an Admin or Moderator... [Given Reason]:" ..L_4_)
			elseif L_1_ == "Ban" then
			if not L_6_:FindFirstChild(L_2_) then
			L_5_.TextTransparency = 0
			L_5_.TextStrokeTransparency = .5
					L_5_.Text = "Player not found!"
				else
					
					--Ban would go here!---

				end
			end
		end
	elseif L_1_ == "Warn" then
		local L_8_ = game.ReplicatedStorage.WarningGUI:Clone()
		local L_9_ = game.Players:FindFirstChild(L_2_)
		if not L_6_:FindFirstChild(L_2_) then
			L_5_.TextTransparency = 0
			L_5_.TextStrokeTransparency = .5
			L_5_.Text = "Player not found!"
		else
			local L_10_ = game:GetService("TweenService")
			local L_11_ = TweenInfo.new(
				.59,
				Enum.EasingStyle.Exponential,
				Enum.EasingDirection.InOut,
				0,
				false,
				0
		)
			local L_12_ = {}

			L_12_.Position = UDim2.new(0.367, 0, 0.284, 0)
			
			local L_13_ = L_10_:Create(L_8_, L_11_, L_12_)
			L_8_.Parent = L_9_.PlayerGui
			L_8_.Base.Frame.Reason.Text = L_4_
			L_13_:Play()
			game.SoundService.UIWoosh_close:Play()
			L_8_.Warning:Play()
		
		end
	end
end)

1 answer

✓ Accepted answer

You can make a new BoolValue called "Banned", and save it using datastores.

If the BoolValue is true, is kicks the player. If it's false, nothing happens.

You can change it using a command.

This discussion is preserved as it was. New answers, comments, and votes are closed.