I can't seem to make this right. I've spent over 30 minutes trying to figure out what I'm doing wrong and I can't figure it out. Please help!
script:
local GamepassID = 898980796
local Door = script.Parent
local GPS = game:GetService("GamePassService")
script.Parent.Touched:connect(function(Player)
if Player.Parent:FindFirstChild("Humanoid") then
local RealPlayer = game.Players:GetPlayerFromCharacter(Player)
if GPS:PlayerHasPass(RealPlayer, GamepassID) then
print("Opening door for", Player)
Door.CanCollide = false
Door.Transparency = 0.5
wait(2)
Door.CanCollide = true
Door.Transparency = 1
else
Player.Parent:BreakJoints()
end
end
end)
output:
AssetId '899341030' is of type Game Pass. Please use GamePassService:PlayerHasPass instead.
Not a valid Player - Referring to line 8.

1 comment
local RealPlayer = game.Players:GetPlayerFromCharacter(Player.Parent) Player.Parent is potentially the players character. Player is whatever touched the part, a leg for example, which is why that parameter is commonly named hit.