Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

leaderstats Identification Help Please?

Asked by 10 years ago

I have the following code:

local human = hit.Parent:findFirstChild("Humanoid")

I know that it searches for the humanoid, but I want to change it so that it finds the "Admins" stat in leaderstats. Do I have to change it from ("Humanoid") into ("Admins") or ("leaderstats")? Or do I change it to anything else?

Thank you for your help

The script as requested:

function onTouched(hit) 
    print("Door Hit") 
    local human = hit.Parent:findFirstChild("Humanoid") 
    if (human ~= nil ) then 
        if human.Parent.Torso.roblox.Texture == texture then
            Door.Transparency = 0.6
            Door.CanCollide = false 
            wait(3) 
            Door.CanCollide = true 
            Door.Transparency = 0 
            print("Human touched door") 
        elseif (checkOkToLetIn(human.Parent.Name)) then 
            print("Human passed test") 
            Door.Transparency = 0.7
            Door.CanCollide = false
            wait(3)
            Door.CanCollide = true 
            Door.Transparency = 0 
        elseif (This is where my question comes in) >=1 then --This part is where I'm stuck on 
            Door.Transparency = 0.7
            Door.CanCollide = false
            wait(3)
            Door.CanCollide = true 
            Door.Transparency = 0 
        end 
    end 
end 

0
Can you post the whole chunk of code please? At least the function. jav2612 180 — 10y
0
Edited. fahmisack123 385 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

The leaderstats aren't found inside the humanoid they're found directly inside the player.

If it were inside a LocalScript it would be like this:

local leaders = game.Players.LocalPlayer:FindFirstChild("leaderstats")
0
How do I get the player for the second elseif? fahmisack123 385 — 10y
0
Is admins a boolvalue? systematicaddict 295 — 10y
Ad

Answer this question