generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Would someone mind teaching me this?

Previous Thread :: Next Thread 
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
06 Jul 2012 08:01 PM
I'm wanting to know how to make a gun...

But a different type... I wan't to add smoke/fire for the guns muzzle flash/flare.

I already have the gun (Its just one brick) but I don't know how to script the gun.

What I know I'm going to need are these (Functions?).

script.Parent.Selected:connect(function(mouse)
mouse.KeyDown:connect(function(key)
if key == "f" then --To fire the gun.

--and for smoke/fire...
local smoke = Instance.new("Smoke",Workspace)
smoke.Opacity = .5
smoke.RiseVelocity = 10
smoke.Size = 10
smoke.Color = Color3.new(28, 28, 28)

--End (Function?)
end
end)
end)

Okay so I know I need that.

BUT if you do know of a WORKING gun template (Script) the please let me know so I can learn how to make guns... (Non-lazer things.)
Report Abuse
Shoqwave is not online. Shoqwave
Joined: 13 May 2012
Total Posts: 215
06 Jul 2012 08:04 PM
If it is a single brick, then just use MouseButton1Down.
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
06 Jul 2012 08:13 PM
-_- Its a single brick. but I don't want MouseButton1Down (Left Click.) to fire the gun. I'm trying to make a gun that only shoots FORWARD and when you press F (Not hold, just press)

Would some one take the time to teach me how?
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
06 Jul 2012 08:15 PM
You can make it go straight even with a button press. Anyways when making it shoot just keep the Y axis of the projectile at a constant value.
Report Abuse
Shoqwave is not online. Shoqwave
Joined: 13 May 2012
Total Posts: 215
06 Jul 2012 08:15 PM
Use Velocity.


Make a projectile and keep it at a constant Velocity.
Keep in mind, the smaller it is, the more velocity affects it.
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
06 Jul 2012 08:21 PM
-_- How do I make a gun. that's what I'm needing to know.

I know I'm going to need velocity... but how do I make the gun?

script.Parent.Selected:connect(function(mouse)
mouse.KeyDown:connect(function(key)
if key == "f" then
local -- Then what?
Report Abuse
Shoqwave is not online. Shoqwave
Joined: 13 May 2012
Total Posts: 215
06 Jul 2012 08:23 PM
As I said, make a projectile and keep it at a constant velocity.
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
06 Jul 2012 08:32 PM
projectile....How do I make the projectile fire from the gun? Instance.new???

Instance.new.something
Something.vector(20.0.0)???

Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
06 Jul 2012 08:52 PM
Could someone teach me how to make a gun?
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
06 Jul 2012 09:12 PM
please?
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
06 Jul 2012 09:45 PM
Hello?
Report Abuse
johnhugh is not online. johnhugh
Joined: 26 Mar 2009
Total Posts: 1971
06 Jul 2012 10:13 PM
make a gun with a block some mesh and a script.
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
06 Jul 2012 10:38 PM
-_- I have a gun. I have the weld script. I don't have the script to make it fire when I press F.

Now, how. Can. I. Make. A. Gun. Script?
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
06 Jul 2012 10:58 PM
Would it look something like this???

local Handle = script.Parent.Handle
script.Parent.Selected:connect(function(mouse)
mouse.KeyDown:connect(function(key)
if key == "f" then
local message = Instance.new("Message", Workspace) --Just to make sure it works.
local smoke = Instance.new("Smoke",Handle) --Muzzle Flash
then
function fire(v)

Tool.Handle.Fire:play()


local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)

local missile = Instance.new("Part")



local spawnPos = vCharacter.PrimaryPart.Position



spawnPos = spawnPos + (v * 8)

missile.Position = spawnPos
missile.Size = Vector3.new(1,1,1)
missile.Velocity = v * 100
missile.BrickColor = BrickColor.new(colors[math.random(1, #colors)])
missile.Shape = 0
missile.BottomSurface = 0
missile.TopSurface = 0
missile.Name = "Paintball"
missile.Elasticity = 0
missile.Reflectance = 0
missile.Friction = .9

local force = Instance.new("BodyForce")
force.force = Vector3.new(0,90,0)
force.Parent = missile

Tool.BrickCleanup:clone().Parent = missile

local new_script = script.Parent.Paintball:clone()
new_script.Disabled = false
new_script.Parent = missile

local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = vPlayer
creator_tag.Name = "creator"
creator_tag.Parent = missile



missile.Parent = game.Workspace

end



Tool.Enabled = true
function onActivated()

if not Tool.Enabled then
return
end

Tool.Enabled = false

local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end

local targetPos = humanoid.TargetPoint
local lookAt = (targetPos - character.Head.Position).unit

fire(lookAt)

wait(.5)

Tool.Enabled = true
end


script.Parent.Activated:connect(onActivated)

message.Text = "FIRE!" --Just to make sure my gun fires...
wait(2)
message:Destroy()
end
end)
end)
Report Abuse
FreeGamesROBLOX is not online. FreeGamesROBLOX
Joined: 15 Jun 2011
Total Posts: 6622
06 Jul 2012 11:01 PM
local message = Instance.new("Message", Workspace) --Just to make sure it works.

Workspace shouldn't have a capital W
Report Abuse
kurnalD is not online. kurnalD
Joined: 24 Jan 2010
Total Posts: 172
06 Jul 2012 11:03 PM
0.0 Wow. Amazing script.I cant do that.*claps* well done.
Report Abuse
kurnalD is not online. kurnalD
Joined: 24 Jan 2010
Total Posts: 172
06 Jul 2012 11:04 PM
Umm "workspace" has a capitol W
Report Abuse
kurnalD is not online. kurnalD
Joined: 24 Jan 2010
Total Posts: 172
06 Jul 2012 11:05 PM
Yes it would look like that. Pretty simple if you breake it down!I dont think you made that!
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
06 Jul 2012 11:07 PM
And nothing happens again....

Okay what am I doing wrong???

Would you mind looking at my tool I have made and see if something is wrong?

http://www.roblox.com/Tool-Help-Please-item?id=85865027
Report Abuse
FreeGamesROBLOX is not online. FreeGamesROBLOX
Joined: 15 Jun 2011
Total Posts: 6622
06 Jul 2012 11:08 PM
@kurnal
Apparently you know nothing about LUA.
When it says just workspace without game., it shouldn't have a capitol W.
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
06 Jul 2012 11:13 PM
Wait is my gun not working cause of the basic roblox GUI?:


local Tool = script.Parent;

enabled = true
function onButton1Down(mouse)
if not enabled then
return
end

enabled = false
mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"

wait(4.1)
mouse.Icon = "rbxasset://textures\\GunCursor.png"
enabled = true

end

function onEquippedLocal(mouse)

if mouse == nil then
print("Mouse not found")
return
end

mouse.Icon = "rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end


Tool.Selected:connect(onEquippedLocal)

Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
06 Jul 2012 11:39 PM
Help please.

Bump
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
07 Jul 2012 01:26 AM
Help?
Report Abuse
kurnalD is not online. kurnalD
Joined: 24 Jan 2010
Total Posts: 172
07 Jul 2012 10:53 AM
Hmm Thats what I always do write it with a capitol!
Report Abuse
kurnalD is not online. kurnalD
Joined: 24 Jan 2010
Total Posts: 172
07 Jul 2012 11:05 AM
I belive your local GUI dosent work because 1.You copied it For obvious reseons it wont work.2. Sorry for my poor grammar.3.It wont work because your local GUI has the OnButton1down function not keypressed "f"
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image