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

How do I add one of those talking NPC's to my game, and make it give you a weapon?

How do I add a NPC bot that gives you the weapon that I want to add, also how do I change the way that bot looks?

2 answers

✓ Accepted answer

There's a tutorial on the Roblox Wiki, maybe next time try just search things before you ask on here. http://wiki.roblox.com/index.php/Dialog_Shop_Tutorial

Follow the tutorial - I've edited out the price bits of the script for you, it should work, so just put this under 'Dialog' and also simply change 'ChoiceA', 'ChoiceB' and 'ChoiceC' to whatever you named your Dialog Choices to, same with Weapon1 Weapon2 and Weapon3.

However if you just want one item in the Dialog then just remove the 'elseif' parts.

local dialog = script.Parent
dialog.DialogChoiceSelected:connect(function(player, choice)

    if choice == script.Parent.DialogChoice.ChoiceA then
            game.ReplicatedStorage.Weapon1:Clone().Parent = player.Backpack
        end

    elseif choice == dialog.DialogChoice.ChoiceB then
            game.ReplicatedStorage.Weapon2:Clone().Parent = player.Backpack
        end

    elseif choice == dialog.DialogChoice.ChoiceC then
            game.ReplicatedStorage.Weapon3:Clone().Parent = player.Backpack
        end
    end
end)

1 comment

0

ok thank you i am no scripter, but i will do as you say :D and yes i only want one weapon

Well, you can try something like this, it's not npc, but if you want to make a sword fighting game it works just fine.

Directions: Put a LinkedSword into Lighting and name it "Sword". Next, put a script into a brick and anchor the brick or part. Next, type this into the 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("Sword") if not findS then local sword = game.Lighting.Sword:Clone() sword.Parent = player.Backpack end end if not find then print('no humanoid') end end)

1 comment

0

Or copy. Hope it worked!

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