Hello fellow Robloxians,
I, being a dummy when it comes to tables, have encountered an issue trying to check whether the IntValue
is equal to the value inside of a table. What I have saved in both values is the number of the car spawner since there’s going to be multiple. To teleport the vehicle to the right CFrame I need to get the teleportCFrame
, however I can’t get the CFrame because when checking whether the values are the same, it attempts to index nil
with plrSpawner
. Here are the important parts of my code, please point out any dumb mistakes I’ve made.
local currentUsers = {}
local function createUserTable(spawner)
local userTable = {
["plrSpawner"] = spawner.Value
}
return userTable
end
local function addUser(userTable, plr)
if userTable then
table.insert(currentUsers, plr.Name)
currentUsers[plr] = userTable
else
return
end
end
local spawnerNumber = spawner:WaitForChild("SpawnerNumber")
if spawnerNumber.Value == currentUsers[plr.Name]["plrSpawner"] then
teleportCFrame = spawner:WaitForChild("TeleportCFrame").CFrame
end
If you need anything else, please let me know.