wpnfcj
(KerW)
July 8, 2023, 11:05am
#1
So I am making a script ban system that stores notes on why the user was banned using a Table. But I don’t know how to print/get the actual note.
I have tried looking on the Engine API and tried it myself but had no luck. Here’s the table I created:
local Banned = {
[-1] = {"This is a note / reason on why player1 is gone"},
}
Slight reminder for those few people.
I am not asking for anyone to script for me i just need help/assistance with an issue im facing
4 Likes
The only thing you need to print your note is to do that :
print(Banned[-1])
Basicaly I’m printing the value attached to -1 but I recommend you in your case to use a dictionnary :
local Banned = {
["Cheated"] = {"You cheated"}
}
print(Banned["Cheated"])
I hope that was helpful have a nice day !
1 Like
wpnfcj
(KerW)
July 8, 2023, 11:29am
#3
Alright so with the dictionary would it work the same if I replaced [“Cheated”] with a players UserId?
Considering how the UserId “-1” would be Player1 when testing local clients.
I’m getting this error:
This is the line that gives me an error
warn(game.Players.LocalPlayer.Name.." is Banned: "..Banned[game.Players.LocalPlayer.UserId]) -- Would supposed to print: "PlayerName is Banned: BanNote"
2 Likes
wpnfcj
(KerW)
July 8, 2023, 11:46am
#4
FireStrykerAzul:
print(Banned[-1])
Update, I used the above script and connected Game.Players.LocalPlayer.userId and it seems to work.
So thanks for the help!
1 Like
To do this you will have to do this :
warn(game.Players.LocalPlayer.Name.." is Banned : "..Banned[Reason])
The reason would be a variable that store a string who’s the name of one of the reason in your table of notes :
local Banned = {
["Reason1"] = "note1",
["Reason2"] = "note2",
["Reason3"] = "note3",
["Reason4"] = "note4",
["Reason5"] = "note5",
}
So if your variable Reason is equal to “Reason2” then it will print : PlayerName is banned : note2
I hope that was helpful have a nice day !
3 Likes
system
(system)
Closed
July 22, 2023, 12:17pm
#6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.