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

[SOLVED] UserId is not a valid member of model?

Asked by 6 years ago
Edited 6 years ago

Hi, im trying to make a vip room. Im using this script for the vip door

print("VIP Door Script loaded") 

local Door = script.Parent

function onTouched(hit) 
    print("Door Hit") 
    local human = hit.Parent:findFirstChild("Humanoid")
    if (human ~= nil ) then
        local player = human.Parent 
        -- a human has touched this door! 
        print("Human touched door") 
        -- test the human's name against the permission list 
        if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 4525252) then 
            print("Human passed test") 
            Door.Transparency = 0.5 
            Door.CanCollide = false 
            wait(4) -- this is how long the door is open 
            Door.CanCollide = true 
            Door.Transparency = 0 
        else 
            hit.Parent:LoadCharacter()
        end 
    end 
end 

script.Parent.Touched:connect(onTouched)

It gives the error message "userid is not a valid member of model". I guess the human.parent part is wrong, but cant find to what i should change it. I hope you can help me.

Edit: Nevermind i just changed it to game.Players:GetPlayerFromCharacter(hit.Parent) and it works.

0
Can you change the question to [SOLVED] + your title? User#20388 0 — 6y

Answer this question