I’ve been playing around with this for hours and I’ve looked up each error I’ve recieved and I still wasn’t able to find a workaround for the errors I’ve been getting.
I’m working on a classic sword fighting game and I’ve been trying to get the players to teleport onto the selected map and each time I change something in the teleport script it just gives me these two errors.
( I don’t have a screenshot for the other error but it was attempting to call a table value )
here’s the part of the script that’s messing up:
for i, player in pairs(plrs) do
if player then
character = player.Character
if character then
character:FindFirstChild("HumanoidRootPart").Position = AvailableSpawn.Poisiton + Vector3.new(0,10,0)
wait(1)
table.remove(AvailableSpawn,1)
(note: plrs is a table of all players in game )
please note that the script is from a tutorial and I’ve looked around all over the internet and was still unable to find a solution. all help is appreciated
From what I’m seeing, AvailableSpawn is in a table? that’s your issue, you’d have to do something weird like :
local a = {workspace.Part1, workspace.Part2} -- The table of stored objects
local random = math.random(1,#a) -- This picks a random object from the table
print(a[random].Position) -- This prints the location of the randomly picked object
Edit, this is probably already known but the table can be like: