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:
1 | script.Parent.Touched:Connect( function (hit) |
2 | if hit and hit.Parent and game.Players:FindFirstChild(hit.Parent.Name) then |
3 | game:GetService( "MarketplaceService" ):PromptProductPurchase(game.Player:FindFirstChild(hit.Parent.Name), 408797380 ) |
4 | end |
5 | end ) |
You missed "s" letter on line 3 and all your script is scattered. Here is the right working script
01 | local MPS = game:GetService( "MarketplaceService" ) |
02 | local productId = 408797380 |
03 |
04 | script.Parent.Touched:Connect( function (hit) |
05 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
06 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
07 | if player then |
08 | MPS:PromptProductPurchase(player, productId) |
09 | end |
10 | end |
11 | end ) |
You can read more here