[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
01 | print ( "VIP Door Script loaded" ) |
03 | local Door = script.Parent |
05 | function onTouched(hit) |
07 | local human = hit.Parent:findFirstChild( "Humanoid" ) |
08 | if (human ~ = nil ) then |
09 | local player = human.Parent |
11 | print ( "Human touched door" ) |
13 | if game:GetService( "MarketplaceService" ):UserOwnsGamePassAsync(player.UserId, 4525252 ) then |
14 | print ( "Human passed test" ) |
15 | Door.Transparency = 0.5 |
16 | Door.CanCollide = false |
18 | Door.CanCollide = true |
21 | hit.Parent:LoadCharacter() |
26 | 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.