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

this question involves detecting if the player is wearing something?

if the player is wearing this hat then it will not deduct health, otherwise it will.

1 answer

I didn't know what you are really trying to make but here is a example on how to detect something

-- this script is in a Part
-- SCRIPT
local Hat = "Fedora"
loca Part = script.Parent

local function onTouched(Hit)
	local Character = Hit.Parent
	if Character ~= nil then
		local Humanoid = Character:FindFirstChildOfClass("Humanoid")
		if Humanoid ~= nil and Humanoid.Health > 0 then
			for _, Child in ipairs(Character:GetChildren()) do
				if Child.Name == Hat then
					-- Does what every you want
				end
			end
		end
	end
end

Part.Touched:connect(onTouched)

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