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

Why isn't this tShirt script working correctly?

--//

local shirt = "http://www.roblox.com/asset/?id=1645744"



function onTouched(hit)
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
	if human.Parent.Torso.roblox.Texture == shirt then
		print "yes"
	else
		print "i_give_up_on_this"
	end
end
end
script.Parent.Sen2.Touched:connect(onTouched)

I'm wearning the right tshirt, but its prints "i_give_up_on_this", please help before I have a mental breakdown on why this isn't working.

2 answers

✓ Accepted answer

Although that is a very unprofessional way of checking if a player is wearing a specific tshirt, I have fixed up the script. But, FYI, I think you shouldnt be using this method.

local shirt = "http://www.roblox.com/asset/?id=1645744"

function onTouched(hit)
	local human = hit.Parent:FindFirstChild'Humanoid'
	if human then
		if hit.Parent:FindFirstChild'Shirt Graphic' then
			if hit.Parent["Shirt Graphic"].Graphic == shirt then
				print'yes'
				elseif hit.Parent["Shirt Graphic"].Graphic ~= shirt then
				print'nope dont give up just because the player doesnt have the shirt!'
			end
		end
	end
end

script.Parent.Sen2.Touched:connect(onTouched)

There you go!

That asset id is the id of a t-shirt. The texture isn't on the shirt's id, but the shirt's id minus 1.

Replace line 3 with

local shirt = "http://www.roblox.com/asset/?id=1645743"

1 comment

0

Thank you, I am only allowed to accept 1 answer, but thank you!

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