✓ Accepted answer
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.
local Part = game.Workspace.Part
local Players = game:GetService("Players")
Part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local playerRoomOneOne = Players:GetPlayerFromCharacter(hit.Parent)
print("Player one from the table, 1 is: "..playerRoomOneOne.Name)
end
end)
1 comment
Additional Note: You are probably going to want to add a debounce so it doesn't print the player touching the part multiple times. Moreover if EEnergy8 is a model you are going to need to reference a specific part within the model that you want to detect players touching.