So I tried searching on YouTube for how to do this but nothing showed so I tried to do this myself after a certain amount of seconds after you invest you get doubled the money. But I’m bad at scripting
If anyone knows anything like this please send me it thx!
script.Parent.Parent.Leaderstats.Cash.Take.Money.Away = "150"
wait(10) then
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Leaderstats.Cash.Give.Money.Away = "250"
end
end
end)
I can’t provide code as I am on my iPad but you need to simplify the name
Local leaderboard = Game.leaderboard.-name of leaderboard-
Leaderboard.value = 250
Wait (10)
Leaderboard.value = leaderboard.value *2
local ds = dss:GetDataStore("GameData")
game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats"
local plrkey = "id_"..player.UserId
local data = ds:GetAsync(plrkey) or {}
local cash = Instance.new("IntValue",leaderstats)
cash.Name = "Cash"
cash.Value = data[1] or 2000
local kills = Instance.new("IntValue",leaderstats)
kills.Name = "Kills"
kills.Value = data[2] or 0
--Kills And Cash Etc
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function(killed)
print("Died")
local CreatorTag = character.Humanoid:FindFirstChild("creator")
print(CreatorTag)
if CreatorTag and CreatorTag.Value then
local stats = CreatorTag.Value:WaitForChild("leaderstats")
stats["Cash"].Value += 20
stats["Kills"].Value += 1
end
end)
end)
end)
game.Players.PlayerRemoving:Connect(function(plr)
ds:SetAsync("id_"..plr.UserId, {plr.leaderstats.Cash.Value, plr.leaderstats.Kills.Value})
end)
game:BindToClose(function()
for i, plr in pairs(game.Players:GetPlayers()) do
ds:SetAsync("id_"..plr.UserId, {plr.leaderstats.Cash.Value, plr.leaderstats.Kills.Value})
end
end)
local cash = script.Parent.Parent.Leaderstats.Cash.Give.Money.Away
---[[making a variable so I don't have to type alot everytime I need to say cash
script.Parent.MouseButton1Click:Connect(function()
wait(10) -- waiting 10 seconds after click
cash = cash*2 --doubling cash
end
I think I know that you mean but I want to be sure. Let’s say you had 100 coins. The cost to invest is 10 coins. You invest and now you have 90 coins. After 10 seconds, your coins are doubled. Do you have 200 coins at the end or 180 coins at the end?