Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why wont my this script distribute the swords to all players with a bool value true?

Asked by 6 years ago

This script is used to distribute swords from the replicated storage by cloning. What's happening is only one character is getting a sword, even though all bools in each character are perfect to receive swords.

PLEASE HELP! Thank you!

function InsertSwords()

    for i, v in pairs(game.Players:GetPlayers()) do
    local playersword = v:WaitForChild("PersonalSword")

    local replicated = game.ReplicatedStorage:GetChildren()

    if v.Ingame.Value == true and v.GameBool.Value == true then

        for i = 1, #replicated do
        if replicated[i].Name == playersword.Value then
        local scheduledsword = game.ReplicatedStorage:FindFirstChild(replicated[i].Name):Clone()
        scheduledsword.Parent = v.Backpack

        end
    end
    end

end

Answer this question