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

How do I make my own weapon?

Asked by 10 years ago

So what I'm trying to do is I'm trying to script and build a weapon but the wiki is quiet hard to understand... And I would always like to script and build my "own" weapon.

2 answers

Log in to vote
0
Answered by 10 years ago

Maybe get a weapon from free models, retexture it, and change the script around, like if it says ~~~~~~~~~~~~~~~~~ target.Humanoid.Health = target.Humanoid.Health - 100

, and you want it to be a sniper, you might want to make it be ~~~~~~~~~~~~~~~~~
target.Humanoid.Health = target.Humanoid.Health - 100

Or search on youtube audi80 how to make a weapon roblox

Ad
Log in to vote
0
Answered by 10 years ago

To build your own weapon you need to make a mesh and put that into a block to give your weapon a shape. Next you have to add scripts to determine how it works (How much damage it does,special effects,sounds,etc.). Then after you have done that you must weld it to your robloxian so it doesn't just fall through the ground when you equip it. Lastly you must decide where to put it (Starter pack so it is for everyone, vip tool script for certain people only, or a script that only gives you the weapon if you buy it or have completed a task. I would suggest that if you don't know much you get a weapon that works from somewhere else and look at the scripts and meshes used to make the weapon work.

Here is an example of a raycast script that I use for guns

local tool = script.Parent local user

--when the tool is equipped tool.Equipped:connect(function(mouse) --store the character of the person using the tool user = tool.Parent

--when the left mouse button is clicked
mouse.Button1Down:connect(function() 
    --make and do a hit test along the ray
    local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit*300)
    local hit, position = game.Workspace:FindPartOnRay(ray, user)

    --do damage to any humanoids hit----------This tells the game to only damage humanoids
    local humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid")
    if humanoid then
        humanoid:TakeDamage(30)**----------This Tells the game how much damage the ray does**
    end

    --draw the ray
    local distance = (position - tool.Handle.CFrame.p).magnitude
    local rayPart = Instance.new("Part", user)
    rayPart.Name          = "RayPart"
    rayPart.BrickColor    = BrickColor.new("Bright red")**--------- Color of the ray**
    rayPart.Transparency  = 0.5**------Transparency of the ray**
    rayPart.Anchored      = true**-------Makes the ray stay in the position in which it was shot until it disappears**
    rayPart.CanCollide    = false**------Allows things to go through the ray**
    rayPart.TopSurface    = Enum.SurfaceType.Smooth
    rayPart.BottomSurface = Enum.SurfaceType.Smooth
    rayPart.formFactor    = Enum.FormFactor.Custom
    rayPart.Size          = Vector3.new(0.2, 0.2, distance)**--------Size of the ray**
    rayPart.CFrame        = CFrame.new(position, tool.Handle.CFrame.p) * CFrame.new(0, 0, -distance/2)**--------Where the ray appears when the weapon is fired**


    game.Debris:AddItem(rayPart, 0.1)**-----Tells the game to add it to debris so that it disappears**
end)

end)

0
Thank you very much, bya! Can you give an example of a script or somthing I may ask? teafulfireball 0 — 10y
0
No problem I added it to my answer byakura 0 — 10y

Answer this question