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

Why wont my vip door work? I have tried multiple times!

Asked by 6 years ago

I can't find whats wrong with my code! I am getting an error, but dont know what it means

local Id =  5266510
script.Parent.Touched:Connect(function(hit)
game:GetService("MarketplaceService"):PlayerOwnsAsset(Id)
script.Parent.CanCollide = false
end)

1 answer

Log in to vote
0
Answered by
aazkao 787 Moderation Voter
6 years ago
Edited 6 years ago

You didnt put the player instance in the PlayerOwnsAsset method, and the method returns a bool value so you should use an if else statement

local Id =  5266510
script.Parent.Touched:Connect(function(hit)

  if hit.Parent:FindFirstChild("Humanoid") then--make sure the object touching the door is a player
     local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
     if game:GetService("MarketplaceService"):PlayerOwnsAsset(plr,Id) then
        script.Parent.CanCollide = false
     end
  end
end)
0
that doesnt work Jack_mud -5 — 6y
0
any errors? aazkao 787 — 6y
1
If it’s a GP then change line 6 to “UserOwnsGamePassAsync(plr,Id)” after MPS ABK2017 406 — 6y
0
18:51:10.450 - Argument 2 missing or nil Jack_mud -5 — 6y
View all comments (10 more)
0
line 06? aazkao 787 — 6y
0
did you declare the Id variable? aazkao 787 — 6y
1
I opened up studio and tested the code it works just fine, as ABK said if its a gamepass change it to UserOwnsGamePassAsync aazkao 787 — 6y
0
did it but still same ;-; Jack_mud -5 — 6y
0
its a pass Jack_mud -5 — 6y
0
Change PlayerOwnsAsset(plr,Id) to UserOwnsGamePassAsync(plr.UserId,Id) green271 635 — 6y
0
i did Jack_mud -5 — 6y
0
did you put plr.UserId in the parameter? aazkao 787 — 6y
0
UserOwnsGamePassAsync(plr.UserId,Id) needs the userid of the player not the player instance aazkao 787 — 6y
0
i did that all but still wont work ;-; Jack_mud -5 — 6y
Ad

Answer this question