When the player load in the game, I have my datastore to know if the player has taken the potion, that send in a localscript the potion that is not taken but I have a problem.
RS.Remotes.BoostNotTaken.OnClientEvent:Connect(function(SpawnName)
for _, spawnpoints in ipairs(SpawnPoints:GetChildren()) do
print(spawnpoints)
if spawnpoints.Name == SpawnName then
if spawnpoints.BoostType.Value == "BasicLuckBoost" then
print(spawnpoints.BoostType.Value)
local BoostNotTaken = RS.Collectibles.BasicLuckBoost:Clone()
BoostNotTaken.Parent = CollFolder
BoostNotTaken.Spawnpoint.Value = spawnpoints.Name
print(BoostNotTaken.Parent)
BoostNotTaken:SetPrimaryPartCFrame(spawnpoints.CFrame)
elseif spawnpoints.BoostType.Value == "MediumLuckBoost" then
local BoostNotTaken = RS.Collectibles.MediumLuckBoost:Clone()
BoostNotTaken.Parent = CollFolder
BoostNotTaken.Spawnpoint.Value = spawnpoints.Name
BoostNotTaken:SetPrimaryPartCFrame(spawnpoints.CFrame)
end
end
end
end)
print(spawnpoints) return me only hive1 to 6
I tried to put in pairsin ipairsSpawnPoints:GetChildren())SpawnPoints:GetDescendants())
if you can help me
Have you gone ingame, and when it for loops, checked that the parts are all still in the folder? Because there might be other scripts deleting parts from the folder. So first make sure that they’re all still there.
actually that print me a lot of times the same things but now that print me more things than only the hive, but that print me more than just on time idk how many time
RS.Remotes.BoostNotTaken.OnClientEvent:Connect(function(SpawnName)
wait(0.2)
for _, spawnpoints in ipairs(SpawnPoints:GetChildren()) do
print(spawnpoints.Name)
if spawnpoints.Name == SpawnName then
if spawnpoints.BoostType.Value == "BasicLuckBoost" then
print(spawnpoints.BoostType.Value)
local BoostNotTaken = RS.Collectibles.BasicLuckBoost:Clone()
BoostNotTaken.Parent = CollFolder
BoostNotTaken.Spawnpoint.Value = spawnpoints.Name
print(BoostNotTaken.Parent)
BoostNotTaken:SetPrimaryPartCFrame(spawnpoints.CFrame)
elseif spawnpoints.BoostType.Value == "MediumLuckBoost" then
local BoostNotTaken = RS.Collectibles.MediumLuckBoost:Clone()
BoostNotTaken.Parent = CollFolder
BoostNotTaken.Spawnpoint.Value = spawnpoints.Name
BoostNotTaken:SetPrimaryPartCFrame(spawnpoints.CFrame)
end
end
end
end)
for _, v in pairs(LuckBoostTaken:GetChildren()) do
if v.Value == false then
RS.Remotes.BoostNotTaken:FireClient(plr, v)
else
print(v.Name.." Has been collected !")
end
end
Yeah it’s firing once for every child of “LuckBoostTaken”, so if you want a print statement it will spam, just remove the print statement and it won’t spam.