Script unexpectedly stops at a point

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.

2 Likes

Did some tinkering with findfirstchild and variables and it’s working! Thank you so much for all your help

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.