I'm a beginner scripter, i'm using Zeds tycoon kit because I don't know how to make my own yet, this script is mine though as are many in my game, small simple ones as yet again I'm a beginner so help would be greatly appreciated. As stated above i'm using Zed's Tycoon kit and i'm trying to make a script to give people 10,000 cash when they join, i've been studying wiki.roblox but I just can't seem to make it work. Help would be greatly appreciated.
Script
id = 540679791 for i,v in pairs (game.Players:GetPlayers()) do if v then if game:GetService("MarketplaceService"):PlayerOwnsAsset(v,id) then local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(v.Name) if cashmoney then cashmoney.Value = cashmoney.Value + 10000 end end end end
Thanks for your time
--Species
Hello! So here's a solution to your problem:
You should use the game pass service instead of marketplace service, also you need to use :PlayerHasPass()
Here's an example, also your script fixed:
id = 540679791 for i,v in pairs (game.Players:GetPlayers()) do if v then if game:GetService("GamePassService"):PlayerHasPass(v,id) then local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(v.Name) if cashmoney then cashmoney.Value = cashmoney.Value + 10000 end end end end
The variables as you can see for :PlayerHasPass is (PLAYER,GAMEPASSID) Hope this worked!