|
| 25 Oct 2017 11:23 AM |
Fight script and cash // I can provide with leaderstats script ------------------------------------------------------- function join(player)
if not (player or game.Players:WaitForChild(player,.1)) then repeat wait(.1); warn("player not found!") until player end
local cash = player.leaderstats.Cash
for reward = 0, game.Players.NumPlayer, 20 do cash.Value = cash.Value + reward cash.Changed:Connect(function() cash.Value = cash.Value + reward end end
return function(name) if name == player[name] then return true end end end
function kill(obj)
if obj.Name == game.Players:WaitForChild("LocalPlayer").Name and (obj:FindFirstChild("Humanoid",true) or obj.Parent:IsAncestorOf("Humanoid")) then
local humanoid = obj.Parent.Humanoid --or obj.Hum... is filtered out local safety = join()
humanoid.Died:Connect(function() game.Players.PlayerAdded:Connect(join) end)
else repeat wait() until humanoid and safety end
return true end
if assert(game.Workspace.ChildAdded:wait(),"error: failed request") game.Workspace.ChildAdded:Connect(kill) end |
|
|
| Report Abuse |
|
|
| |
|
22618709
|
  |
| Joined: 25 Dec 2011 |
| Total Posts: 19221 |
|
| |
|
| |
|
| |
|
|
| 25 Oct 2017 12:27 PM |
------------------------late response was eating pizza----------------------
federalReserve = {
bank = Instance.new("Folder"), money = Instance.new("IntValue"),
security = function() local agency = {}
for asset,type in pairs(federalReserve) do agency[asset] = type end
return agency end,
translate = function(logX,logY,logZ) logX.money.Value = logX.money.Value + math.abs(logY.NumPlayer%logZ) end }
transport = federalReserve.security()
function comms(government) if not government then repeat warn("government body missing") until government end local state, currency = transport.bank, transport.money
state.Name = "leaderstats"; state.Parent = government currency.Name = "Cash"; currency.Parent = state
return transport.translate(transport,game.Players,government) end
game.Players.PlayerAdded:Connect(comms) |
|
|
| Report Abuse |
|
|
|
| 25 Oct 2017 01:10 PM |
The issue is, sorry for not making it clear before, the data stored in IntValue is not persistent beyond client application. I made a script which backsup userdata to a Roblox backend server. It is commonly referred to as, Data Store, and for the sake of simplicity please help me find a solution to solve this problem.
If you would like to see this script please do let me know in advance. ^_^ |
|
|
| Report Abuse |
|
|
| |
|
|
| 25 Oct 2017 07:24 PM |
ok? -------------------------------------- local repStorage,notify = game:GetService("ReplicatedStorage"), Instance.new("RemoteEvent") notify.Name = "Notify" notify.Parent = repStorage
function leave(player)
playerId,cash = tostring(player.UserId), player.leaderstats.Cash cashStore = game:GetService("DataStoreService"):GetDataStore("CashStore",playerId)
local test,money = pcall(function() return cash Store:SetAsync(cash,cash.Value) end) if test then cash.Value = cash.Value else notify:FireClient(player.Name, "error: failed to save, try again later") end
end
function join(player) if player then
local test, money = pcall(function() return cashStore:GetAsyc(cash) end) if test then cash.Value = cash.Value else notify:FireClient(player.Name, "error: failed to load, try again later") end
else game.Players:WaitForChild("LocalPlayer") end return game.Players.PlayerRemoving:Connect(leave) end
game.Players.PlayerAdded:Connect(join) |
|
|
| Report Abuse |
|
|
|
| 25 Oct 2017 08:05 PM |
function checksum(player) if player and player.Character then local cash,humanoid = player.leaderstats.Cash, player.Character.Humanoid
if cash.Value >= 30 then cash.Value = cash.Value - 30 humanoid.MaxHealth = humanoid.MaxHealth + 10
if humanoid:GetChangedPropertySignal(property) then if property.Name == "MaxHealth" and cash.Changed:wait() then humanoid.Health = humanoid.MaxHealth end end
else print("insufficient funds") end else repeat game.Players:WaitForChild("LocalPlayer,1) until player.CharacterAdded:wait() end
return switch = true end)
game.Players.PlayerAdded:Connect(function(plyr) switch = true while wait() do if switch then switch = false checksum(plyr) end end) |
|
|
| Report Abuse |
|
|
Chrounum
|
  |
| Joined: 04 Apr 2015 |
| Total Posts: 2911 |
|
|
| 25 Oct 2017 08:50 PM |
ok
when the meme so supreme you let out a scream... ^o^ |
|
|
| Report Abuse |
|
|
| |
|
D3D9
|
  |
| Joined: 20 Aug 2016 |
| Total Posts: 87 |
|
| |
|