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

Need Help Completing my ban system. n not working?

Ok, Im trying to make like the jailbreak thingy but my game... I've put this script inside starter Character and it isnt even printing out why it isnt working.. Plz Help :(

local BanPart = Instance.new("Part",game.Workspace)

BanPart.Position = Vector3.new(-198.49, 7.55, -127.81)

BanPart.Anchored = true

BanPart.CanCollide = false

BanPart.Transparency = 2



local HaxPerson = {"malachiRashee"}

local DoritosGud = script.Parent:WaitForChild('HumanoidRootPart') --MAKES NO SENSE.

wait(2)

game.Players.PlayerAdded:Connect(function(player)

	for i,v in pairs(HaxPerson) do 

		while true do

			wait()

			DoritosGud.Position = BanPart.Position

		end

	end

end)

--I've been trying this over days...

5 comments

0

Please use the lua code block tool

0

Please use the lua code block tool

0

a

0

The script was inside StarterCharacter because i didnt know how to do it.

0

I suggest using NotedAPI's answer as he uses CFrame and userids

3 answers

✓ Accepted answer

I don't know if this works.

local BanPart = Instance.new("Part",game.Workspace)
BanPart.Name = "BanPart"
BanPart.Position = Vector3.new(-198.49, 7.55, -127.81)
BanPart.Anchored = true
BanPart.CanCollide = false
BanPart.Transparency = 1

local BannedPeople = {"YamadaRikkuDev"} -- example person, you can place people's name you don't like.
-- also please use userids as people change their names in roblox

--local DoritosGud = script.Parent:WaitForChild('HumanoidRootPart') --MAKES NO SENSE.
-- put this in serverscriptservice please because this script uses the PlayerAdded function

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(chr)
		wait(.1)
		for i,v in pairs(BannedPeople) do
			if v == player.Name then
				chr:WaitForChild("HumanoidRootPart").CFrame = CFrame.new(BanPart.Position)
				print("You've been banned, " .. player.Name .. "!")
				-- i don't know what to do here, you can replace the teleportation code with the :Kick() function
			end
		end
	end)
end)

If you don't know how this works, let me explain.

The script makes a BanPart in workspace so that the players that are banned will need to go there. Then, it connects a PlayerAdded function in which occurs when a player has joined the game and connects the CharacterAdded function in which occurs when the player's character has loaded in workspace.

If a CharacterAdded function has fired/occurred, the script waits about .1 seconds after the character spawns, checks if the player's in the ban list. If they're one of them, the player will be teleported to a ban part or kicked and the script prints that the player has been banned.

--[[
	Normal Script in ServerScriptService
]]

-- services --
local players = game:GetService("Players")

-- locals -- 
local banned = {
	1, -- roblox
	1361134044, -- notedapi
}

-- script --
local BanPart = Instance.new("Part",game.Workspace)
BanPart.Position = Vector3.new(-198.49, 7.55, -127.81)
BanPart.Anchored = true
BanPart.CanCollide = false
BanPart.Transparency = 2

players.PlayerAdded:Connect(function(player)
	local isbanned = table.find(banned, player.userId) -- you can look on the api about table.find
	
	if isbanned then
		while wait() do
			if player.Character then
				if player.Character:FindFirstChild("HumanoidRootPart") then
					player.Character:FindFirstChild("HumanoidRootPart").CFrame = BanPart.CFrame
				end
			end
		end
	end
end)

First of all, you can't set transparency over 1, which is invisible. What I think your DoritosGud variable is the HumanoidRootPart of the Hacker.

So what I would do is:

local BanPart = Instance.new("Part",game.Workspace)

BanPart.Name = "BanPart"

BanPart.Position = Vector3.new(-198.49, 7.55, -127.81)

BanPart.Anchored = true

BanPart.CanCollide = false

BanPart.Transparency = 2

local HaxPerson = {"malachiRashee"}


wait(2)

game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)

for i,v in pairs(HaxPerson) do
if player.Name == v then
local DoritosGud =char:WaitForChild('HumanoidRootPart') 
    while true do

        wait()

        DoritosGud.Position = BanPart.Position

end
end
end
end)
end)

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