Basically, There are 2 Characters in The Table RoomOneTable I'm trying to Compare the Character's Name with Local Player's Name but I get this error attempt to index nil with 'Name'
So if The Player is on the table and pressed the Key, a print appears, if anyone could help?
local UIS = game:GetService("UserInputService")
local randomKey = workspace.Rooms.RoomOne.randomKey
local player = game.Players.LocalPlayer
local RoomOneTable = require(game.ReplicatedStorage.Rooms.RoomOne.RoomOneMod)
workspace.Rooms.RoomOne.randomKey.Changed:Connect(function()
if player.Name == RoomOneTable[1].Name or RoomOneTable[2].Name then
UIS.InputBegan:Connect(function(key, whileTalking)
if whileTalking then return end
if key.KeyCode == Enum.KeyCode[randomKey.Value] then
print(player.Name.." Won a point")
end
end)
print("value changed")
end
end)

3 comments
I've explained this a few times in your previous attempts, I believe—if not, here is why. UserInputService is an API that is designed for user-input recognition & management; for such a thing to work, it would need to be situated on the local device. To simplify, you can only use this Service in a LocalScript, which then will eliminate the need to determine where the input came from.
A ServerScript situates the operation on ROBLOX's end, whilst a LocalScript is ran through your ROBLOX-Player program on your device. If you're unfamiliar with what a Server is exactly, It's primitive you research on that, and a little more on networking to tie everything together. Essentially, a Server is a machine specifically designed to host Client machines (Players in this case).
Therefore, a Server isn't an actual Client itself, therefore there is no affiliated Player Object of its own (thus why attempting to reference a LocalPlayer in its environment returns as null). To resolve your problem, listen for the input in a LocalScript, as required, and launch the result to a ServerScript for evaluation via a RemoteEvent.