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

Can someone help me with this?

Asked by 9 years ago
local swords = { --Keep swords in a model called "Swords" and put the model inside of ServerStorage. Make sure the strings in this table are the same as the swords name.
--  [Killstreak] = "Sword Name"
    [0] = "Classic Sword";
    [5] = "Ghostwalker";
    [10] = "Illumina";
    [15] = "Darkheart"
}

local swordGiver = script.Parent

swordGiver.Touched:connect(function(hit)
    local character = hit.Parent
    local player = game.Players:GetPlayerFromCharacter(character)
    if player and not character:FindFirstChild("HasSword") then
        local killstreak = player.leaderstats.Killstreak.Value
        for req, sword in pairs(swords) do
            if killstreak >= req then
                game.Workspace.Lighting.Swords[sword]:clone().Parent = player.Backpack
            end
        end
        Instance.new("ObjectValue", character).Name = "HasSword"
    end
end)

plr.Character.Humanoid.Died:connect(function(die)
    plr.Backpack.Venomshank:Destroy()
end)
plr.Character.Humanoid.Died:connect(function(die)
    plr.Backpack.Illumina:Destroy()
end)
plr.Character.Humanoid.Died:connect(function(die)
    plr.Backpack.Darkheart:Destroy()
end)

1 answer

Log in to vote
-1
Answered by 9 years ago

Whats wrong?

Ad

Answer this question