Hello.
I’m making a city game, and you can buy things, and some/half of the money goes to the leader of the server. I got the pay system working, but I have no idea on how to pay the leader, and I’m pretty much lost. Thanks for helping:
local prompt = script.Parent
local replicatedstorage = game:GetService("ReplicatedStorage")
local leavejobevent = replicatedstorage:WaitForChild("LeaveJob")
local ServerScriptService = game:GetService("ServerScriptService")
local DataStore2 = require(ServerScriptService.DataStore2)
local replicatedservice = game:GetService("ReplicatedStorage")
local eatevent = replicatedservice:WaitForChild("Eat")
local stringval = prompt.Parent.Parent.Job.Value
local replicatedstorage = game:GetService("ReplicatedStorage")
local taxes = replicatedstorage:WaitForChild('Taxes')
prompt.Triggered:Connect(function(player)
local CashData = DataStore2("Cash", player)
local playerstrn = game.Players:GetPlayerByUserId(stringval.Value)
local JobData = DataStore2("Cash", playerstrn)
local totalcash = 10 / taxes.Value
if taxes.Value == 0 then
JobData:Increment(10)
playerstrn.Hunger.Value += 50
else
print(totalcash)
JobData:Increment(totalcash)
playerstrn.Hunger.Value += 50
end
if CashData:Get() >= 10 then
CashData:Increment(-10)
player.Hunger.Value += 50
else
return
end
end)
leavejobevent.OnServerEvent:Connect(function(player)
player.PlayerGui.JobGui.Enabled = false
stringval.Value = ""
player.Character.Humanoid.WalkSpeed = 16
player.Character.Humanoid.UseJumpPower = true
player.Character.Humanoid.JumpPower = 50 -- regular jumpspeed is 50
prompt.Parent.Parent.Prox.ProximityPrompt.Enabled = false
prompt.Parent.Parent.Job.ProximityPrompt.Enabled = true
end)