#Help, idk why dis doesnt work :)

1 messages · Page 1 of 1 (latest)

topaz parcel
weary path
#

Show output

topaz parcel
#

It adds JumpPower, output is empty, and are tagged tOUCHED

#

Food part hierarchy

meager latch
#

I assume, there is no while loop in first picture beside loop of foods?

Since it only loop if you start the server, and that's is it?

topaz parcel
#

that fixed it, how would you do while loops? i did it kinda like this

#

I just put it in one script, was easier

#

local food = game.Workspace.FoodFolder.FoodObjects
local CollectionService = game:GetService("CollectionService")
local FoodMultiplicator = 1
local FoodSpawnTime = 5

game.Players.PlayerAdded:Connect(function(player)
player:WaitForChild("leaderstats")
local jumpPower = player.leaderstats:WaitForChild("JumpPower")

for _, foodItem in pairs(food:GetChildren()) do
foodItem.Touched:Connect(function(OtherPart)
local character = OtherPart.Parent
local humanoid = character:FindFirstChild("Humanoid")
local player = game.Players:GetPlayerFromCharacter(character)

if humanoid and player and not CollectionService:HasTag(foodItem, "Touched") then
    jumpPower.Value += math.random(5, 10) * FoodMultiplicator
    CollectionService:AddTag(foodItem, "Touched")
            if foodItem:IsA("BasePart") then
                foodItem.Transparency = 1
                foodItem.CanCollide = false
            end

for _, child in pairs(foodItem:GetChildren()) do
if child:IsA("BasePart") or child:IsA("Decal") then
child.Transparency = 1
end
end
task.delay(FoodSpawnTime, function()
if foodItem:IsA("BasePart") then
foodItem.Transparency = 0
foodItem.CanCollide = true
end

    for _, child in pairs(foodItem:GetChildren()) do
        if child:IsA("BasePart") or child:IsA("Decal") then
        child.Transparency = 0
        end
    end
                CollectionService:RemoveTag(foodItem, "Touched")
            end)
        end
    end)
end

end)