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
 

Re: Automatic minigun problem

Previous Thread :: Next Thread 
radioactivated is not online. radioactivated
Joined: 05 Sep 2009
Total Posts: 1181
02 Sep 2011 04:26 PM
Any way to utilize loops/values to make a gun automatic?
Report Abuse
radioactivated is not online. radioactivated
Joined: 05 Sep 2009
Total Posts: 1181
02 Sep 2011 04:39 PM
Guys!
Report Abuse
TheCoolDog is not online. TheCoolDog
Joined: 22 Oct 2009
Total Posts: 811
02 Sep 2011 04:41 PM
Yes, how is this a problem?
Report Abuse
radioactivated is not online. radioactivated
Joined: 05 Sep 2009
Total Posts: 1181
02 Sep 2011 04:42 PM
Idk, butwhen I use my knowledge of it, the minigun fails to fire.
Report Abuse
radioactivated is not online. radioactivated
Joined: 05 Sep 2009
Total Posts: 1181
02 Sep 2011 05:04 PM
Guys. (repeated post)
Report Abuse
TheCoolDog is not online. TheCoolDog
Joined: 22 Oct 2009
Total Posts: 811
02 Sep 2011 05:05 PM
Guys what?

What do you want!
Report Abuse
radioactivated is not online. radioactivated
Joined: 05 Sep 2009
Total Posts: 1181
02 Sep 2011 05:06 PM
I want some help on some way to use a loop to make a stupid automatic gun!
Report Abuse
radioactivated is not online. radioactivated
Joined: 05 Sep 2009
Total Posts: 1181
02 Sep 2011 05:50 PM
bump
Report Abuse
radioactivated is not online. radioactivated
Joined: 05 Sep 2009
Total Posts: 1181
02 Sep 2011 08:42 PM
Almost forgot, using loops on raycasting(horrible keyboard)
Report Abuse
radioactivated is not online. radioactivated
Joined: 05 Sep 2009
Total Posts: 1181
03 Sep 2011 11:16 AM
bump
Report Abuse
agent1011126 is not online. agent1011126
Joined: 28 May 2011
Total Posts: 85
03 Sep 2011 11:18 AM
maybe if you post the script you have so far, we can find the problem.
Report Abuse
JonathanSwag is not online. JonathanSwag
Joined: 30 Aug 2011
Total Posts: 1012
03 Sep 2011 11:18 AM
Yup, post the script.
Report Abuse
radioactivated is not online. radioactivated
Joined: 05 Sep 2009
Total Posts: 1181
03 Sep 2011 11:33 AM
Clarification: How to use a loop with this script:
local Tool = script.Parent --Set a variable for the tool.
local User --Create a nil value for the character which we can't find yet.
Tool.Equipped:connect(function(mouse) --When it's equipped fire a function.
User = Tool.Parent --Set the User variable to the character of the person using the tool.
mouse.Button1Down:connect(function() --When the left mouse button is clicked fire a function.
Tool.Handle.Fire:play()
local Ray = Ray.new(Tool.Handle.CFrame.p,(mouse.Hit.p-Tool.Handle.CFrame.p).unit*300) --Make a the ray.
local Hit,Position = game.Workspace:FindPartOnRay(Ray,User) --Check for collisions along the ray.
if Hit then --If it hits something.
if Hit.Parent:FindFirstChild("Humanoid") then --If the thing the ray hit has a humanoid.
Hit.Parent.Humanoid:TakeDamage(50) --Do 30 damage if they don't have a forcefield.
end --End the humanoid check.
end --End the hit check.
local RayPart = Instance.new("Part",User) --Create a part in the user.
RayPart.Name = "RayPart" --Set its name.
RayPart.BrickColor = BrickColor.new("Bright green") --Set its color.
RayPart.Transparency = 0.1 --Set its transparency.
RayPart.Reflectance = 0.1
RayPart.Anchored = true --Set whether it will fall or not.
RayPart.CanCollide = false --Set whether people can walk though it or not.
RayPart.TopSurface = Enum.SurfaceType.Smooth --Make it smooth on the top.
RayPart.BottomSurface = Enum.SurfaceType.Smooth --Make it smooth on the bottom.
RayPart.formFactor = Enum.FormFactor.Custom --Make it so it can be small.
local Distance = (Position-Tool.Handle.CFrame.p).magnitude --Find the distance between the click and the gun.
RayPart.Size = Vector3.new(0.2,0.2,Distance) --Set its size to the distance.
RayPart.CFrame = CFrame.new(Position,Tool.Handle.CFrame.p) * CFrame.new(0,0,-Distance/2) --Move it halfway.
game.Debris:AddItem(RayPart,0.1) --Add it to the debris.
wait(2)
end)
end)
To make a automatic gun?
Report Abuse
radioactivated is not online. radioactivated
Joined: 05 Sep 2009
Total Posts: 1181
03 Sep 2011 11:42 AM
Useless bump(on first page)
Report Abuse
darkkiller5555 is not online. darkkiller5555
Joined: 22 Nov 2009
Total Posts: 6359
03 Sep 2011 11:45 AM
>.> Just run it until it fires the .Button1Up event?
Report Abuse
radioactivated is not online. radioactivated
Joined: 05 Sep 2009
Total Posts: 1181
03 Sep 2011 11:48 AM
I'll try... I'm not much of a scripter
Report Abuse
radioactivated is not online. radioactivated
Joined: 05 Sep 2009
Total Posts: 1181
03 Sep 2011 12:11 PM
._. I can't firgure out how.
Report Abuse
radioactivated is not online. radioactivated
Joined: 05 Sep 2009
Total Posts: 1181
03 Sep 2011 12:14 PM
No one is answering
Report Abuse
Fredfishy is not online. Fredfishy
Joined: 21 Mar 2009
Total Posts: 4197
03 Sep 2011 12:17 PM
is_firing = false

function onButton1Down(mouse)
while is_firing do
print("BEWM")
e = Instance.new("Explosion", Workspace)
e.Position = mouse.Hit.p
e.BlastPressure = 1000000
e.BlastRadius = 9001
wait()
end
end

function onEquipped(mouse)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end

script.Parent.Equipped:connect(onEquipped)
Report Abuse
Fredfishy is not online. Fredfishy
Joined: 21 Mar 2009
Total Posts: 4197
03 Sep 2011 12:18 PM
Fail script was fail :c





is_firing = false

function onButton1Up(mouse)
is_firing = false
end

function onButton1Down(mouse)
is_firing = true
while is_firing do
print("BEWM")
e = Instance.new("Explosion", Workspace)
e.Position = mouse.Hit.p
e.BlastPressure = 1000000
e.BlastRadius = 9001
wait()
end
end

function onEquipped(mouse)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.Button1Up:connect(function() onButton1Up(mouse) end)
end

script.Parent.Equipped:connect(onEquipped)
Report Abuse
radioactivated is not online. radioactivated
Joined: 05 Sep 2009
Total Posts: 1181
03 Sep 2011 12:20 PM
Not using explosions. Using raycasting to make a SMG lasergun.
Report Abuse
radioactivated is not online. radioactivated
Joined: 05 Sep 2009
Total Posts: 1181
03 Sep 2011 12:23 PM
Ty for the script anyway
Report Abuse
Fredfishy is not online. Fredfishy
Joined: 21 Mar 2009
Total Posts: 4197
03 Sep 2011 12:29 PM
Yus, but you can just edit that to suit your needs. Or edit your original script or whatever.
Report Abuse
radioactivated is not online. radioactivated
Joined: 05 Sep 2009
Total Posts: 1181
03 Sep 2011 12:31 PM
Crap. Integrate a script and it breaks.

is_firing = false

function onButton1Up(mouse)
is_firing = false
end

function onButton1Down(mouse)
is_firing = true
while is_firing do
Tool.Handle.Fire:play()
local Ray = Ray.new(Tool.Handle.CFrame.p,(mouse.Hit.p-Tool.Handle.CFrame.p).unit*300) --Make a the ray.
local Hit,Position = game.Workspace:FindPartOnRay(Ray,User) --Check for collisions along the ray.
if Hit then --If it hits something.
if Hit.Parent:FindFirstChild("Humanoid") then --If the thing the ray hit has a humanoid.
Hit.Parent.Humanoid:TakeDamage(5) --Do 30 damage if they don't have a forcefield.
end --End the humanoid check.
end --End the hit check.
local RayPart = Instance.new("Part",User) --Create a part in the user.
RayPart.Name = "RayPart" --Set its name.
RayPart.BrickColor = BrickColor.new("Bright green") --Set its color.
RayPart.Transparency = 0.1 --Set its transparency.
RayPart.Reflectance = 0.1
RayPart.Anchored = true --Set whether it will fall or not.
RayPart.CanCollide = false --Set whether people can walk though it or not.
RayPart.TopSurface = Enum.SurfaceType.Smooth --Make it smooth on the top.
RayPart.BottomSurface = Enum.SurfaceType.Smooth --Make it smooth on the bottom.
RayPart.formFactor = Enum.FormFactor.Custom --Make it so it can be small.
local Distance = (Position-Tool.Handle.CFrame.p).magnitude --Find the distance between the click and the gun.
RayPart.Size = Vector3.new(0.2,0.2,Distance) --Set its size to the distance.
RayPart.CFrame = CFrame.new(Position,Tool.Handle.CFrame.p) * CFrame.new(0,0,-Distance/2) --Move it halfway.
game.Debris:AddItem(RayPart,0.1) --Add it to the debris.
wait(0.2)
end
end

function onEquipped(mouse)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.Button1Up:connect(function() onButton1Up(mouse) end)
end

script.Parent.Equipped:connect(onEquipped)
Report Abuse
Fredfishy is not online. Fredfishy
Joined: 21 Mar 2009
Total Posts: 4197
03 Sep 2011 12:37 PM
Is it in a local script?
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