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
 

A part of my gun script crashes roblox?

Previous Thread :: Next Thread 
zekey101 is not online. zekey101
Joined: 08 Aug 2011
Total Posts: 2499
01 Dec 2013 02:16 PM
Okay you can play the game but if you shoot every thing crashes. The gun is a 3 shot burst and this is the part of the script that crashes.

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 * 500
missile.BrickColor = BrickColor.new(26)
missile.Shape = 0
missile.BottomSurface = 0
missile.TopSurface = 0
missile.Name = "Bullet"
missile.Elasticity = 0
missile.Reflectance = 0
missile.Friction = .9
missile.CanCollide = false

local force = Instance.new("BodyForce")
force.force = Vector3.new(0,missile:getMass() * 196,0)
force.Parent = missile

local mesh = Instance.new("SpecialMesh")
mesh.Scale = Vector3.new(.06,.06,.06)
mesh.MeshType = "Sphere"
mesh.Parent = missile

local new_script = script.Parent.Bullet: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

cam = game.Workspace.CurrentCamera
local cam_rot = cam.CoordinateFrame - cam.CoordinateFrame.p
local cam_scroll = (cam.CoordinateFrame.p - cam.Focus.p).magnitude
local ncf = CFrame.new(cam.Focus.p)*cam_rot*CFrame.fromEulerAnglesXYZ(0.01, -0.01, 0)
cam.CoordinateFrame = ncf*CFrame.new(0, 0, cam_scroll)
weld33.C1 = CFrame.new(-0.75, -0.7, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-16), 0)
weld55.C1 = CFrame.new(0.8, 0, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(275), 1, math.rad(-0))
Tool.Flash.Mesh.Scale = Vector3.new(1.727, 3, 1.727)
Tool.Flash.Transparency = .5
Tool.A1.Mesh.Offset = Vector3.new(0, 0.6, 0)
canreload = false
for i = 1,3 do
fire(v)
wait(2)
Choosy()
end
end
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
01 Dec 2013 02:17 PM
for i = 1,3 do
fire(v)
wait(2)
Choosy()
end

You're recursively calling the function in itself.
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