So I have been scripting a door so that when you touch it some of your data will load into the game. Well for whatever reason the UserId is returning this error: "UserId is not a valid member of Model". Here is the code:
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local plr = hit.Parent
local specialKey = "User_"..plr.UserId
-- more code here but that is irrelevant.
end
end)
What is even more confusing however, is the fact that in this script it works:
game.Players.PlayerAdded:Connect(function(plr)
local specialKey = "User_"..plr.UserId
end)

1 comment
Oh! Thank you so much.