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

Ko Sword Giver [closed]

Asked by 11 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
2
Answered by
nate890 495 Moderation Voter
11 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:

01local 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.
02--  [KOs] = "Sword Name"
03    [0] = "Classic Sword";
04    [10] = "Venomshank"
05}
06 
07local swordGiver = script.Parent
08 
09swordGiver.Touched:connect(function(hit)
10    local character = hit.Parent
11    local player = game.Players:GetPlayerFromCharacter(character)
12    if player and not character:FindFirstChild("HasSword") then
13        local kos = player.leaderstats.KOs.Value
14        for req, sword in pairs(swords) do
15            if kos >= req then
View all 21 lines...

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!

0
Ill try this matt10010010010 0 — 11y
Ad
Log in to vote
0
Answered by 10 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
-1
Answered by 11 years ago

Try something like this.

01requiredkos = 0
02script.Parent.Touched:connect(function(h)
03    if h.Parent:findFirstChild("Humanoid") then
04        local human = h.Parent:findFirstChild("Humanoid")
05 
06        if human.Health > 0 then
07            local p = game.Players:GetPlayerFromCharacter(human.Parent)
08 
09            if p:findFirstChild("leaderstats") then
10                local kos = p:findFirstChild("KOs")
11 
12                if kos and kos.Value > requiredkos then
13                    --give them the sword
14                end
15            end
16        end
17    end
18end)
0
Im trying to make one for like 10 Kos = VenomShank and so on matt10010010010 0 — 11y