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

Why is my VIP door for people with vip t-shirt not working?

Hey, I created a VIP t-shirt and a door that opens when you have the t-shirt put on. But it doesn't work, I've done everything correctly for my feeling and I did subtract 1 in the URL, so I don't know what I am doing wrong, in the output it says Workspace.Part.Script:4: attempt to index field 'Parent'(a nil value)

local Door = script.Parent

function onTouch(Brick)
	local Player = Brick.Parent:findFirstChild("Humanoid")
	if (Player ~= nil) then
		if Player.Parent.Torso.roblox.Texture == "http://www.roblox.com/asset/?version=1&id=1303165260" then
			Door.CanCollide = false
			Door.Transparency = 0.5
			Door.BrickColor = BrickColor:Random()
			wait(2)
			Door.CanCollide = true
			Door.Transparency = 0
			Door.BrickColor = BrickColor:Random()
			else Player.Health = 0
		end
	end
end
Door.Touched:connect(onTouch)

Not subtracting 1 in the URL doesn't work either

1 answer

Fixed it! I found the correct ID

local Door = script.Parent

function onTouch(Brick)
	local Player = Brick.Parent:findFirstChild("Humanoid")
	if (Player ~= nil) then
		if Player.Parent.Torso.roblox.Texture == "http://www.roblox.com/asset/?id=1303165252" then
			Door.CanCollide = false
			Door.Transparency = 0.5
			Door.BrickColor = BrickColor:Random()
			wait(2)
			Door.CanCollide = true
			Door.Transparency = 0
			Door.BrickColor = BrickColor:Random()
			else Player.Health = 0
		end
	end
end
Door.Touched:connect(onTouch)

Instead of 1303165261 it was 1303165252, still don't know why tho.

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