Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago
Edited 6 years ago

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

Log in to vote
0
Answered by 6 years ago

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.

Ad

Answer this question