Log in to vote

Ko Sword Giver [closed]

Asked by 9 years ago

I need help on how to make a script on how to make a Sword Giver that only works on a number of KOs, should i use a local script or a Regular Script?

Locked by FearMeIAmLag, Muoshuu, and BlueTaslem

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

3 answers

Log in to vote
Answered by
nate890 495 Moderation Voter
9 years ago

Since there is really no reason to use a LocalScript here, I would use a Script instead. You can learn when and how to use a LocalScript here.

Assuming that you want the user that touches the button to get all the swords they are eligible for, you would do something like this:

local swords = { --Keep swords in a model called "Swords" and put the model inside of Lighting. Make sure the strings in this table are the same as the swords name.
--  [KOs] = "Sword Name"
    [0] = "Classic Sword";
    [10] = "Venomshank"

local swordGiver = script.Parent

    local character = hit.Parent
    local player = game.Players:GetPlayerFromCharacter(character)
    if player and not character:FindFirstChild("HasSword") then
        local kos = player.leaderstats.KOs.Value
        for req, sword in pairs(swords) do
            if kos >= req then
                game.Lighting.Swords[sword]:clone().Parent = player.Backpack
        end"ObjectValue", character).Name = "HasSword"

In order for the character to update/receive the swords that they are eligible for they must reset their character because the "HasSwords" ObjectValue needs to be removed (from their character.)

Hope this helps!

Ill try this matt10010010010 0 — 9y
Log in to vote
Answered by 8 years ago

Just do this, get a leaderboard, get the gui like Firebrand:100 kos Swordcane: 5 those kind of things in startergui, then put all the swords you have in lightning (The ones that are in the gui like firebrand,swordcane insert that and put it in lightning

Log in to vote
Answered by 9 years ago

Try something like this.

requiredkos = 0
    if h.Parent:findFirstChild("Humanoid") then
        local human = h.Parent:findFirstChild("Humanoid")

        if human.Health > 0 then
            local p = game.Players:GetPlayerFromCharacter(human.Parent)

            if p:findFirstChild("leaderstats") then
                local kos = p:findFirstChild("KOs")

                if kos and kos.Value > requiredkos then
                    --give them the sword
Im trying to make one for like 10 Kos = VenomShank and so on matt10010010010 0 — 9y