Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

leaderstats Identification Help Please?

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 

2 comments

0

Can you post the whole chunk of code please? At least the function.

0

Edited.

1 answer

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")

2 comments

0

How do I get the player for the second elseif?

0

Is admins a boolvalue?

This discussion is preserved as it was. New answers, comments, and votes are closed.