Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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!

1 comment

0

Thank you so much!

This discussion is preserved as it was. New answers, comments, and votes are closed.