Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Settigs:
- },
- ['AutoCollect'] = {
- ['Cooldown'] = 3,
- ['Collect'] = true,
- },
- }
- --AutoCollect: Vergessen zu erwähnen, erstellt euch ein Script unter "Workspace" und Fügt dort diese Script ein.
- local Tycoon = script.Parent.Parent
- local TycoonTeamColor = script.Parent.TeamColor
- local CurrencyToCollect = script.Parent.CurrencyToCollect
- local Owner = script.Parent.Owner
- local Settings = require(script.Parent.Parent.Parent.Settings)
- local CurrentPlr = nil
- local CurrentPlrId = 0
- local cooldown = Settings.AutoCollect.Cooldown
- Owner.Changed:Connect(function()
- if Settings.AutoCollect.Collect == true then
- print(Settings.AutoCollect.Collect)
- if Owner.Value ~= nil then
- repeat
- wait(cooldown)
- for i, v in pairs(game:GetService("Players"):GetChildren()) do
- if v.TeamColor == TycoonTeamColor.Value then
- if CurrentPlr ~= v.Name then
- CurrentPlr = v.Name
- local success, err = pcall(function()
- id = game:GetService("Players"):GetUserIdFromNameAsync(CurrentPlr)
- end)
- if success then
- CurrentPlrId = id
- end
- if err then
- print("Error while using :GetUserIdFromNameAsync()")
- end
- print(CurrentPlr)
- print(CurrentPlrId)
- end
- if game.ServerStorage:FindFirstChild("PlayerMoney"):FindFirstChild(v.Name) then
- if CurrencyToCollect.Value ~= 0 then
- --local GamePassId = 0
- --if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(CurrentPlrId,GamePassId) then
- --game.ServerStorage:FindFirstChild("PlayerMoney"):FindFirstChild(v.Name).Value = game.ServerStorage:FindFirstChild("PlayerMoney"):FindFirstChild(v.Name).Value + CurrencyToCollect.Value * 2
- --CurrencyToCollect.Value = 0
- --else
- game.ServerStorage:FindFirstChild("PlayerMoney"):FindFirstChild(v.Name).Value = game.ServerStorage:FindFirstChild("PlayerMoney"):FindFirstChild(v.Name).Value + CurrencyToCollect.Value
- CurrencyToCollect.Value = 0
- end
- end
- end
- end
- until Owner.Value == nil
- else
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement