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

Cannot find texture ID player is wearing?

Hi,

I am attempting to operate a t-shirt/shirt only door at which only operates when someone has the correct clothing on. I think this is the older way of performing the task of collecting the texture ID that someone is wearing and wanted to know the new way to get this to work? The links there are correct so it's just helping the script find the texture the player is wearing?

print ("VIP T-Shirt Door Script Loaded")


permission = { "kieranm9090" } 


first = "http://www.roblox.com/asset/?version=1&id=412190047" 
premiumeco = "http://www.roblox.com/asset/?version=1&id=412190012"



function checkOkToLetIn(name) 
	for i = 1,#permission do 
		
		if (string.upper(name) == string.upper(permission[i])) then return true end 
	end 
	return false 
end 

local Door = script.Parent

function onTouched(hit) 
	print("Door Hit") 
	local human = hit.Parent:findFirstChild("Humanoid") 
	if (human ~= nil ) then 
		if human.Parent.Torso.roblox.Texture == first or premiumeco then 
			Door.Transparency = 1 
			Door.CanCollide = false
			wait(4)  
			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(4) 
			Door.CanCollide = true 
			Door.Transparency = 0  
		end 
	end 
end 

script.Parent.Touched:connect(onTouched)

Many thanks, Kieran

1 answer

✓ Accepted answer

Instead of 'or', you have to separate 'first' and 'premiumco' from each other and give them their own statement.

local Door = script.Parent

function onTouched(hit) 
    print("Door Hit") 
    local human = hit.Parent:findFirstChild("Humanoid") 
    if (human ~= nil ) then 
        if human.Parent.Torso.roblox.Texture == first then 
           openDoor()

	elseif human.Parent.Torso.roblox.Texture == premiumeco then 
	    openDoor()

        elseif (checkOkToLetIn(human.Parent.Name)) then 
            print("Human passed test") 
            Door.Transparency = 0.7
            Door.CanCollide = false 
            wait(4) 
            Door.CanCollide = true 
            Door.Transparency = 0  
        end 
    end 
end 

function openDoor()
	 Door.Transparency = 1 
            Door.CanCollide = false
            wait(4)  
            Door.CanCollide = true 
            Door.Transparency = 0 
	    print("Human touched door") 
end

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