Verify that the Role
property exists in the Player
object. You can use the FindFirstChild
method to check if the Role
property exists before accessing it. For example:
local player = game:GetService("Players"):FindFirstChild("Player1")
if player and player:FindFirstChild("Role") then
-- Access the Role property
local roleValue = player.Role.Value
-- Rest of the code
else
print("Role property does not exist in Player1")
end
This code snippet checks if the Player1
object exists and if it has a Role
property. If the Role
property exists, you can access its value using player.Role.Value
.
Also Ensure that the Role
property has the correct value. If the Role
property exists but the script still says it does not, double-check the value of the Role
property. It’s possible that there is a mismatch between the expected value and the actual value of the Role
property.