Basically, RoomOneTable[1]
== Workspace.EEnergy8
I'm trying to get the Player from Character
Error: attempt to index nil with 'Name
local playerRoomOneOne = game.Players:GetPlayerFromCharacter(RoomOneTable[1]) print("Player one from the table, 1 is: "..playerRoomOneOne.Name)
You are currently trying to get the player from the object instead of a character which is why it is not working. The thing you need to do is check if something touches the part. If it has a humanoid then the parent of it is a character. You can then GetPlayerFromCharacter and run the rest of your script.
I have attached a sample script below.
--VARIABLES: --In this case you would want to reference the table instead ie game.Workspace.EEnergy8 local Part = game.Workspace.Part local Players = game:GetService("Players") --hit is the thing which touches the part (or in your case table) Part.Touched:Connect(function(hit) --In order to get the player from character you first need to find a character. --All characters have humanoids so first check if whats touching the table has a humanoid. if hit.Parent:FindFirstChild("Humanoid") then --We know hits parent is the character because it has a first child of humanoid. --Now we can use Players:GetPlayerFromCharater local playerRoomOneOne = Players:GetPlayerFromCharacter(hit.Parent) print("Player one from the table, 1 is: "..playerRoomOneOne.Name) end end)