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
https://devforum.roblox.com/t/i-need-help-making-a-ban-script/263726
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.