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

I'm making a bossfight, and I want it to give the player a sword?

Asked by 3 years ago

Right now, I've made it so it shows a button to get the sword. What could I do to make it GIVE them the sword instead of them clicking a button?

Here is the script:

    wait(0.5)
    game.Workspace.Cave:Stop()
    wait(1)
    for _,player in pairs(game.Players:GetPlayers()) do
                    player.PlayerGui.ScreenGui.TextButton.Visible = true
    end
    wait(2)
        game.ServerScriptService.bossfightScript.Disabled = false

1 answer

Log in to vote
0
Answered by 3 years ago

Something you can do is get yourself a clone of the sword:

local SwordClone = game.ReplicatedStorage.Sword:Clone()

and do something like

local SwordClone = game.ReplicatedStorage.Sword:Clone()
for _,player in pairs(game.Players:GetPlayers()) do
    SwordClone.Parent = player.Backpack
end

But somethings wrong.. it will only give it to one player, thats cause we only have one copy of the sword, an easy solution around this is:

for _,player in pairs(game.Players:GetPlayers()) do
    local SwordClone = game.ReplicatedStorage.Sword:Clone()
    SwordClone.Parent = player.Backpack
end

this way we get one copy of the sword for every player we find and put it in their backpack.

I hope this helps!

0
Thank you so much! DriBowser 55 — 3y
Ad

Answer this question