Hello, here is the script I have so far and im getting this error:
15:48:37.186 - Player is not a valid member of DataModel
Can anybody help me?
Here is my script:
script.Parent.Touched:Connect(function(hit)
if hit and hit.Parent and game.Players:FindFirstChild(hit.Parent.Name) then
game:GetService("MarketplaceService"):PromptProductPurchase(game.Player:FindFirstChild(hit.Parent.Name), 408797380)
end
end)

1 comment
game.Players, ah. Also don't use FindFirstChild on Players, just use GetPlayerFromCharacter and do game.Players:GetPlayerFromCharacter(hit.Parent). It's much more reliable, and no need to do if hit and hit.Parent and ... then