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

can someone fix this for me? as ive tried on the discord and theres a lot wrong (its a ban script)

local player = script.Parent.Player.Text

local DataStoreService = game:GetService("DataStoreService")

local DataStoreBan = DataStoreService:GetDataStore("DataStoreBan")

local Reason = script.Parent.Parent.Reason.Text

if

script.Parent function leftClick()then game.ReplicatedFirst.Instance.new("IntValue") game.ReplicatedFirst.IntValue.Name = player game.ReplicatedFirst.player.Value = player game.Players.PlayerAddded:Connect(Function(Player)) if local game.Players.LocalPlayer.Name = player true then local PlayerId = game.Players.player.UserID game.ReplicatedFirst.player.Value = PlayerID if game.Players.player.UserID = PlayerID true then plr:Kick("Reason")

end

2 answers

First off, describe your issue. I could easily say there's nothing wrong (although there is) so describe what problem are you having and what your goal is.

Second, indent your code and add a code block for the sake of simplicity.

Now, the quotes where it says

plr:Kick("Reason")

should not be there as they represent a string, for example:

local Message = "Hello world!"
print("Message")

would print "Message", and

local Message = "Hello world!"
print(Message)

would print "Hello world!".

Basically, with strings you are sending a string value, without you are sending an UserData value which could be an instance or a property as an example.

Now, why did you add

if
script.Parent function leftClick()then

Are you attempting to detect when a user clicks? In that case they could just not left click at all and evade the ban. A way better method is to detect when they join the game, using

game.Players.PlayerAdded

, stating

user

as the argument on the function, then detecting if the player that joined has the name of the one stated on the Text property, and if the value returns true, execute the ban.

For that you would use:

game.Players.PlayerAdded:Connect(function(user)
     if user.Name == player then
          -- execute the ban
     end
end)

If I'm wrong or I didn't understand what you meant, please tell me. (also excuse my horrible indentation because im on mobile.

1 comment

0

its a gui to ban people for creators

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