You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? I am making a inventory like system in a round based game. I made a number value that is named what the object is and then the value is how much of it that player has. Then they will spawn in and it will clone however many times the value is.
What is the issue? I have already got this working because I would subtract the value every time it plays and make it not play if it is at zero. But once I make a saving system, if you are in the round it wont save the amount of potions you have if you are in the round, because I made it zero cloning the potions.
**What solutions have you tried so far?**I’ve looked it up many times and tried to change my code, but it didn’t work. I just don’t know how I would word it.
(This is my first time making a post and it is probably very unclear, so please ask questions if you dont understand.)
I don’t completely understand your issue. Can you post your code in a reply to let me look at it and ill see what’s wrong with it? Do you know how to add code?
while wait(0.5) do
for i,plr in pairs(game.Players:GetChildren()) do
ammountofjump = plr.Potions.JumpPotions
if plr.team == game.Teams.Playing then
print("Playing")
if ammountofjump.Value >= 1 then
wait(1)
local jumpclone = game.ServerStorage.Potions.JumpPotion:Clone()
jumpclone.Parent = plr.Backpack
ammountofjump.Value = ammountofjump.Value - 1
end
end
end
This does what I want but it makes the value go down, is there a way to make it run through the loop as many times as the value is without changing it?
while true do
task.wait(.5)
for _,plr in pairs(game.Players:GetPlayers()) do
ammountofjump = plr.Potions.JumpPotions
if plr.team == game.Teams.Playing then
print("Playing")
for i = 1, #ammountofjump.Value do
local jumpclone = game.ServerStorage.Potions.JumpPotion:Clone()
jumpclone.Parent = plr.Backpack
end
end
end
end