Hello all! I apologize if this has been requested or asked before but I have looked multiple times and can’t seem to figure this out.
I am working on a game with witches and a character selection screen - I need the ability to prevent players from selecting characters others are using.
To do this, I thought I would use a table and a remotevent which would fire and change the value in the table.
The issue is, it’s not a string. I don’t know how to edit or change a non-string within a table.
I can’t change it to a string. As far as I’m aware, you can’t set a true/false value to a string within a table. It needs the true/false value.
I don’t want to change my method unless there is no possible way to do this.
My code:
Module Script with the Values I need to change:
local M = {
PlayersStorage = script.PlayersStorage,
Characters = {
Zoe = false,
},
}
MainRemote.OnServerEvent:Connect(function(Player, Type, ...)
print("Hey its me from the server we fired")
if Type == "TakeCharacter" then
print("U want to select character? Ok")
local Data = {...}
local Character = Data[1]
if table.find(M.Characters, Character) then
print("table found them!!")
local Character = table.find(M.Characters, Character)
if Character == true then
print("what.")
return "Taken"
else
print("AS EXPECTED")
Character = true
end
else
print("Cannot select nonexistant people")
end
end
end)
LocalScript where it is changed:
game.ReplicatedStorage.Events.MainRemote:FireServer("TakeCharacter", "Zoe")
When the event is fired, it returns with “Cannot select nonexistant people”
How would I get around this?