Basically I made dragon balls. I have DB1 - DB7 in the player data as bool value for each player. I'm trying to make it so if a player has the bool value to true, don't spawn the dragon ball. But my for loop is checking for EVERYONE if they all have it to true, don't spawn or else it does spawn. All I want is to make it so if 1 player has the bool value to true, it doesn't spawn that certain dragon ball.
Script inside dragon ball
local db = script.Parent
local debounce = true
function onTouch(hit)
if debounce then
if hit.Parent:FindFirstChild("Humanoid") then
debounce = true
db:Destroy()
local player = hit.Parent.Name
game.Players[player].Data.DB1.Value = true
debounce = false
end
end
end
db.Touched:connect(onTouch)
Script you gave me waffle:
while wait(1)do
for i=1,7 do
local rDB=true
if not workspace:FindFirstChild(i.." Star")then
for _,v in next,game.Players:GetPlayers()do
if v.Data["DB"..i].Value then
rDB=false
break
end
end
end
if rDB then
game.ServerStorage[i.." Star"]:Clone().Parent=workspace
end
end
end

12 comments
Thanks! I didn't know everything else was unnecessary. I don't really know how to use tables that well.
The only table here is the list of players that you're iterating through. If their DB# is true, tell it to not clone. If it was never told to not clone, it clones.
It's not working exactly correct. Now i need to keep touching it for how many players are in the server to get it. I don't know what the problem is, or else do I need to add a debounce to it? Inside the DB script i mean for the "Touched" event.
I don't know what you're talking about because you never posted any of that.
I edited the script, the top one is the script inside the 1 star ball
edited answer
There is a problem with the script you gave me. When I touch it, it gives me the true value , but it takes like 7 seconds for the dragon ball to disappear.
EIther 7 seconds or i just have to keep touching it like 20 times for it to disappear
Nothing here is causing that to happen.
So then the script is deffective or Roblox is defective?
But whatever, Roblox sucks, I'll just accept your answer
Nothing here is defective. You haven't posted the thing that is wrong.