I have a script where when you touch a part (its actually a union) and if you have a gamepass, then it is supposed to teleport you to said place, and if you dont own the gamepass, it prompts the purchase of the gamepass. But it doesnt work for no reason, i would really appreciate if you would look into this!
local player = game.Players.LocalPlayer
local id = 7549285
local teleport = game.Workspace.VIPAREA
script.Parent.Touched:Connect(function(part)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player, id) then
local humanoid = part.Parent:FindFirstChild("Humanoid")
if (humanoid ~= nil) then
humanoid.Parent.Head.CFrame = CFrame.new(teleport.CFrame)
end
else
game:GetService("MarketplaceService"):PromptGamePassPurchase(player, id)
end
end)

9 comments
teleport their humanoid root part instead of their head
it says the error is in line 6? Idk what you mean, could you show me an example
What does the error say
Argument 1, Missing or Nil
Is this a server script or a local script?
server script
do player.userId instead of player on line 6
Ill try that
still doesnt work