When the player clicks the part, it gets inserted to the part

after 6 Seconds, the player is supposed to teleport, i made it into a function, but i get this error ServerScriptService.Script:14: attempt to index nil with 'HumanoidRootPart'

What am i doing wrong

local theGameOne = require(game.ReplicatedStorage.ModuleScript)

workspace.Part.ClickDetector.MouseClick:Connect(function(click)
    table.insert(theGameOne, click)
    
    for i, v in pairs(theGameOne) do
        print(v.." is in the table!")
    end

end)

local function theNewRound(player1) 
    player1.HumanoidRootPart.CFrame = CFrame.new(1,1,1)
end

wait(6)
print("starting")

theNewRound(theGameOne[1])

2 comments

0

The HumanoidRootPart is a child of the Player's Character** Object.

0

In the function theNewRound, you are passing player1. But when you call the function, you say theGameOne[1]. I think that may be the problem.