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

How do I put more than one weapon into this script?

script.Parent.Touched:Connect(function(hit)
    local find = hit.Parent:FindFirstChild("Humanoid")
    if find then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        local findS  = player.Backpack:FindFirstChild("Rocket")
        if not findS then -- Or you can use if findS == nil then
            local sword = game.Lighting.Rocket,Dynamite,Bomb:Clone()
            sword.Parent = player.Backpack
        end
    else -- Use else, not use if not find then
        print('no humanoid')
    end
end)

I want to put more than one weapon into this script so when the player touches the brick they'll get more than one weapon. Also, this is my script I did not copy it nor stole it. So stop saying I stole it. Thanks!

1 comment

0

You literally took this from yHasteeD?????

1 answer

You can make another variable with FindFirstChild()

Here is the fixed script:

script.Parent.Touched:Connect(function(hit)
    local find = hit.Parent:FindFirstChild("Humanoid")
    if find then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        local findS  = player.Backpack:FindFirstChild("Rocket")
	local findA = player.Backpack:FindFirstChild("Your tool here")
        if not findS then -- Or you can use if findS == nil then
            local sword = game.Lighting.Rocket:Clone() -- Do not put game.Lighting.Tool1,Tool2,Tool3.
            sword.Parent = player.Backpack
        end
	if not findA then
		local tool = game.Lighting.TOOL:Clone()
		tool.Parent = player.Backpack
	end
    else -- Use else, not use if not find then
        print('no humanoid')
    end
end)

Hope it hleped :)

9 comments

0

Where do I put the weapon names?

0

in the finA variable and in "local tool = game.Lighting. PUT NAME HERE:Clone()"

0

Do I put Rocket,dynamite?

0

create another FindFirstChild variables.

0

Please stop asking for people to make scripts for you! That is not what the site is for.

0

Thanks

0

sjr04alt i'm not asking ppl to make scripts for me. I need help fixing my script. So please mind your own business. Also i'm going to mute you. Bye :)

3

There's no mute feature on the site, lol. And you are. You're just requesting the fix. Maybe don't be lazy and try fixing the issue with that stolen code.

0

I didn't stole the code kid.I had it on my roblox studio and it wasn't working. Also i'm just going to ignore you/

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