✓ Accepted answer
First off you had a space where you wouldn't want one
Old
local p = game.Players:GetPlayerFromCharacter(Hit.Parent) .Folder.rank == "HighBorn"
New
local p = game.Players:GetPlayerFromCharacter(Hit.Parent).Folder.rank == "HighBorn"
Also, hit is just a function, so we cant call it when using getplayerfromcharacter because hit isnt the character. You are thinking of ontouched and hit would be inside the () like function touched(HIT) but in this clickdetector script player is inside the () like function clicked(player)
next one line 2 if highborn isn't there it'll result in an error.
So we will check if its there BEFORE we set it.
if player:FindFirstChild("Folder")~=nil and player.Folder:FindFirstChild("Rank")~=nil then
and im assuming that rank is a stringvalue so we cant just do if rank=="highborn" we need to do
if rank.Value=="HighBorn"
so if we fix all of these problems this is the script we will come up with.
function clicked(player)
if player:FindFirstChild("Folder")~=nil and player.Folder:FindFirstChild("Rank")~=nil then
if player.Folder.Rank.Value=="HighBorn" then
workspace.Union.CanCollide=false
else
print("U aint oldenough")
end
end
end
script.Parent.ClickDetector.MouseClick:connect(clicked)
Hoped this helped :)