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: gun problems

Previous Thread :: Next Thread 
23134 is not online. 23134
Joined: 20 Dec 2011
Total Posts: 35
23 Jul 2014 09:56 PM
in this game I made you have to shoot zombies and when im on roblox studio they work fine but when im playing for real they only work a little.

what do I do?
Report Abuse
Legoman654 is not online. Legoman654
Joined: 05 Jun 2008
Total Posts: 534
23 Jul 2014 09:57 PM
The first thing you should do is post some code for us to examine.
Report Abuse
23134 is not online. 23134
Joined: 20 Dec 2011
Total Posts: 35
23 Jul 2014 09:58 PM
already a reply lol

let me get some
Report Abuse
23134 is not online. 23134
Joined: 20 Dec 2011
Total Posts: 35
23 Jul 2014 10:05 PM
shooter script

Tool = script.Parent

local arms = nil
local torso = nil
local weld33 = nil -- right arm
local weld55 = nil -- left arm
local welds = {}
local reloading = false
local canreload = true
local canshoot = true
local damage = 200

function ReloadSequence()
weld33.C1 = CFrame.new(-0.95, 0.1, 0.45) * CFrame.fromEulerAnglesXYZ(math.rad(-93), math.rad(-25), 0.1)
weld55.C1 = CFrame.new(-0.23, 0.1, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(324), -0.2, math.rad(-85))
Tool.Handle.M1:play()
Tool.Mag.Transparency = 1
local mag = Tool.Mag:clone()
mag.Parent = game.Workspace
mag.CanCollide = false
mag.Transparency = 0
Tool.Mag2.Transparency = 1
local mag = Tool.Mag2:clone()
mag.Parent = game.Workspace
mag.CanCollide = false
mag.Transparency = 0
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.55) * CFrame.fromEulerAnglesXYZ(math.rad(-96), math.rad(-25), 0.2)
weld55.C1 = CFrame.new(-0.21, 0, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(328), -0.3, math.rad(-80))
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-99), math.rad(-25), 0.3)
weld55.C1 = CFrame.new(-0.19, -0.1, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(332), -0.4, math.rad(-75))
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-100.5), math.rad(-25), 0.35)
weld55.C1 = CFrame.new(-0.17, -0.1, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(336), -0.5, math.rad(-70))
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-102), math.rad(-25), 0.4)
weld55.C1 = CFrame.new(-0.15, -0.1, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(340), -0.6, math.rad(-65))
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-104.5), math.rad(-25), 0.45)
weld55.C1 = CFrame.new(-0.13, -0.1, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.7, math.rad(-60))
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-106), math.rad(-25), 0.5)
weld55.C1 = CFrame.new(-0.11, -0.1, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(348), -0.8, math.rad(-55))
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-107.5), math.rad(-25), 0.55)--raise part
weld55.C1 = CFrame.new(-0.11, -0.1, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(348), -0.9, math.rad(-50))
wait(.12)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-108), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, -0.12, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.8, math.rad(-55))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0.75, 0)
Tool.Mag.Transparency = 0
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-108.1), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, -0.14, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.7, math.rad(-60))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0.7, 0)
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-108.2), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, -0.16, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.6, math.rad(-65))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0.65, 0)
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-108.3), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, -0.18, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.5, math.rad(-70))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0.6, 0)
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-108.4), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, -0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.4, math.rad(-75))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0.55, 0)
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-108.5), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, -0.22, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.3, math.rad(-80))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0.5, 0)
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-108.6), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, -0.24, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.2, math.rad(-85))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0.45, 0)
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-108.7), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, -0.26, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.1, math.rad(-90))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0.4, 0)
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-107.85), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, -0.13, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.05, math.rad(-90))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0.2, 0)
Tool.Handle.M2:play()
wait(.12)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-107), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, 0, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), 0, math.rad(-90))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0, 0)
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.57) * CFrame.fromEulerAnglesXYZ(math.rad(-102), math.rad(-25), 0.42)
weld55.C1 = CFrame.new(-0.14, 0.05, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(338), -0.025, math.rad(-90))
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.49) * CFrame.fromEulerAnglesXYZ(math.rad(-98), math.rad(-25), 0.29)
weld55.C1 = CFrame.new(-0.17, 0.1, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(332), -0.05, math.rad(-90))
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.41) * CFrame.fromEulerAnglesXYZ(math.rad(-94), math.rad(-25), 0.16)
weld55.C1 = CFrame.new(-0.20, 0.15, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(326), -0.075, math.rad(-90))
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.1, math.rad(-90))
end

function ReloadSequence2()
weld33.C1 = CFrame.new(-0.95, 0.1, 0.45) * CFrame.fromEulerAnglesXYZ(math.rad(-93), math.rad(-25), 0.1)
weld55.C1 = CFrame.new(-0.23, 0.1, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(324), -0.2, math.rad(-85))
Tool.Handle.M1:play()
Tool.Mag.Transparency = 1
local mag = Tool.Mag:clone()
mag.Parent = game.Workspace
mag.CanCollide = false
mag.Transparency = 0
Tool.Mag2.Transparency = 1
local mag = Tool.Mag2:clone()
mag.Parent = game.Workspace
mag.CanCollide = false
mag.Transparency = 0
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.55) * CFrame.fromEulerAnglesXYZ(math.rad(-96), math.rad(-25), 0.2)
weld55.C1 = CFrame.new(-0.21, 0, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(328), -0.3, math.rad(-80))
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-99), math.rad(-25), 0.3)
weld55.C1 = CFrame.new(-0.19, -0.1, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(332), -0.4, math.rad(-75))
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-100.5), math.rad(-25), 0.35)
weld55.C1 = CFrame.new(-0.17, -0.1, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(336), -0.5, math.rad(-70))
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-102), math.rad(-25), 0.4)
weld55.C1 = CFrame.new(-0.15, -0.1, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(340), -0.6, math.rad(-65))
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-104.5), math.rad(-25), 0.45)
weld55.C1 = CFrame.new(-0.13, -0.1, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.7, math.rad(-60))
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-106), math.rad(-25), 0.5)
weld55.C1 = CFrame.new(-0.11, -0.1, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(348), -0.8, math.rad(-55))
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-107.5), math.rad(-25), 0.55)--raise part
weld55.C1 = CFrame.new(-0.11, -0.1, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(348), -0.9, math.rad(-50))
wait(.12)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-108), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, -0.12, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.8, math.rad(-55))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0.75, 0)
Tool.Mag.Transparency = 0
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-108.1), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, -0.14, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.7, math.rad(-60))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0.7, 0)
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-108.2), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, -0.16, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.6, math.rad(-65))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0.65, 0)
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-108.3), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, -0.18, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.5, math.rad(-70))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0.6, 0)
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-108.4), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, -0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.4, math.rad(-75))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0.55, 0)
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-108.5), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, -0.22, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.3, math.rad(-80))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0.5, 0)
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-108.6), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, -0.24, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.2, math.rad(-85))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0.45, 0)
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-108.7), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, -0.26, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.1, math.rad(-90))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0.4, 0)
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-107.85), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, -0.13, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), -0.05, math.rad(-90))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0.2, 0)
Tool.Handle.M2:play()
wait(.12)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.65) * CFrame.fromEulerAnglesXYZ(math.rad(-107), math.rad(-25), 0.55)
weld55.C1 = CFrame.new(-0.11, 0, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(344), 0, math.rad(-90))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.Mag2.Transparency = 0
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.57) * CFrame.fromEulerAnglesXYZ(math.rad(-102), math.rad(-25), 0.42)
weld55.C1 = CFrame.new(-0.14, 0.05, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(338), -0.025, math.rad(-90))
Slide1()
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.49) * CFrame.fromEulerAnglesXYZ(math.rad(-98), math.rad(-25), 0.29)
weld55.C1 = CFrame.new(-0.17, 0.1, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(332), -0.05, math.rad(-90))
Slide3()
Tool.Handle.M3:play()
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.41) * CFrame.fromEulerAnglesXYZ(math.rad(-94), math.rad(-25), 0.16)
weld55.C1 = CFrame.new(-0.20, 0.15, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(326), -0.075, math.rad(-90))
wait(.05)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.1, math.rad(-90))
end

function Reload()
Tool.Left.Value = Tool.Ammo.Value
if script.Parent.Ammo.Value < script.Parent.MaxAmmo.Value and reloading == false and script.Parent.StoredAmmo.Value >= 1 and canreload == true then
reloading = true
script.Parent.Ammo.Value = 0
ReloadChoose()
script.Parent.StoredAmmo.Value = script.Parent.StoredAmmo.Value + script.Parent.Left.Value
if script.Parent.StoredAmmo.Value >= script.Parent.MaxAmmo.Value then
script.Parent.StoredAmmo.Value = script.Parent.StoredAmmo.Value - script.Parent.MaxAmmo.Value
script.Parent.Ammo.Value = script.Parent.MaxAmmo.Value
script.Parent.Recoil.Value = 5
elseif script.Parent.StoredAmmo.Value < script.Parent.MaxAmmo.Value and script.Parent.StoredAmmo.Value >= 1 then
script.Parent.Ammo.Value = script.Parent.StoredAmmo.Value
script.Parent.StoredAmmo.Value = 0
script.Parent.Recoil.Value = 5
end
reloading = false
end
end

function ReloadChoose()
if script.Parent.Left.Value == 0 then
ReloadSequence2()
elseif script.Parent.Left.Value >= 1 then
ReloadSequence()
end
end

function Slider()
if script.Parent.Ammo.Value == 0 then
Slide2()
elseif script.Parent.Ammo.Value >= 1 then
Slide3()
end
end

function Slider2()
if script.Parent.Ammo.Value == 0 then
Slide2()
Tool.Handle.Empty:play()
elseif script.Parent.Ammo.Value >= 1 then
Slide3()
end
end

function Slide1()
Tool.A1.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A2.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A3.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A4.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A5.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A6.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A7.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A8.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A9.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A10.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A11.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A12.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A13.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A14.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A15.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A16.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A17.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A18.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A19.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A20.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A21.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A22.Mesh.Offset = Vector3.new(0, 0, 0.18)
Tool.A23.Mesh.Offset = Vector3.new(0, 0.18, 0)
Tool.A24.Mesh.Offset = Vector3.new(0, 0.18, 0)
Tool.A25.Mesh.Offset = Vector3.new(0, 0.18, 0)
Tool.A26.Mesh.Offset = Vector3.new(0.18, 0, 0)
end

function Slide2()
Tool.A1.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A2.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A3.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A4.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A5.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A6.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A7.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A8.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A9.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A10.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A11.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A12.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A13.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A14.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A15.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A16.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A17.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A18.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A19.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A20.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A21.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A22.Mesh.Offset = Vector3.new(0, 0, 0.36)
Tool.A23.Mesh.Offset = Vector3.new(0, 0.36, 0)
Tool.A24.Mesh.Offset = Vector3.new(0, 0.36, 0)
Tool.A25.Mesh.Offset = Vector3.new(0, 0.36, 0)
Tool.A26.Mesh.Offset = Vector3.new(0.36, 0, 0)
end

function Slide3()
Tool.A1.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A2.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A3.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A4.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A5.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A6.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A7.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A8.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A9.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A10.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A11.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A12.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A13.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A14.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A15.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A16.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A17.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A18.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A19.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A20.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A21.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A22.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A23.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A24.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A25.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.A26.Mesh.Offset = Vector3.new(0, 0, 0)
end

function Takeout()
local canreload = false
local canshoot = false
weld33.C1 = CFrame.new(-0.95, 0.1, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-78), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.3, math.rad(-90))
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-82), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.2, math.rad(-90))
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-86), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.1, math.rad(-90))
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), 0, math.rad(-90))
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.1, math.rad(-90))
local canreload = true
local canshoot = true
end

function Equip(mouse)
wait(0.01)
arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
torso = Tool.Parent:FindFirstChild("Torso")
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = nil
sh[2].Part1 = nil
falsearm1 = arms[1]:clone()
local mesh1 = Tool.Larm:clone()
mesh1.Parent = falsearm1
local armweld1 = Instance.new("Weld")
falsearm1.BrickColor = BrickColor.new("Light orange")
falsearm1.Parent = Tool
armweld1.Parent = falsearm1
armweld1.Part0 = falsearm1
armweld1.Part1 = arms[1]
falsearm2 = arms[2]:clone()
local mesh2 = Tool.Rarm:clone()
mesh2.Parent = falsearm2
local armweld2 = Instance.new("Weld")
falsearm2.BrickColor = BrickColor.new("Light orange")
falsearm2.Parent = Tool
armweld2.Parent = falsearm2
armweld2.Part0 = falsearm2
armweld2.Part1 = arms[2]
local weld1 = Instance.new("Weld") -- left arm
weld55 = weld1
weld1.Part0 = torso
weld1.Parent = torso
weld1.Part1 = arms[1]
weld1.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -1, math.rad(-90))
welds[1] = weld1
local weld2 = Instance.new("Weld") -- right arm
weld33 = weld2
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = arms[2]
weld2.C1 = CFrame.new(-0.95, 0.1, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-76), math.rad(-25), 0)
welds[2] = weld2
Takeout()
end
else
print("sh")
end
else
print("arms")
end
end

local legs = nil
local torso2 = nil
local welds2 = {}
local bodyforce = nil

function Unequip(mouse)
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = arms[1]
sh[2].Part1 = arms[2]
welds[1].Parent = nil
welds[2].Parent = nil
falsearm1:remove()
falsearm2:remove()
end
else
print("sh")
end
else
print("arms")
end
end

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 * 1)

missile.Position = spawnPos
missile.Size = Vector3.new(1,1,1)
missile.Velocity = v * 800
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(.01,.01,.01)
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.012, -0.011, 0)
cam.CoordinateFrame = ncf*CFrame.new(0, 0, cam_scroll)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-92), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.05, math.rad(-90))
Tool.Flash.Mesh.Scale = Vector3.new(1.462, 1.7, 1.462)
Tool.Flash.Transparency = .5
Slide2()
canreload = false
wait(.03)
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.013, -0.013, 0)
cam.CoordinateFrame = ncf*CFrame.new(0, 0, cam_scroll)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.1, math.rad(-90))
Tool.Flash.Transparency = 1
Slider2()
canreload = true
end

function KeyDownFunctions(key)
if key == "r" then
Reload()
end
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 ammo = script.Parent.Ammo
local maxammo = script.Parent.MaxAmmo
firing = true
while firing == true do
wait()
if reloading == false and humanoid.Health >= 1 then
if ammo.Value >= 1 then
ammo.Value = ammo.Value - 1
local targetPos = humanoid.TargetPoint
local lookAt = (targetPos - character.Head.Position).unit
if script.Parent.Recoil.Value < 2 then
script.Parent.Recoil.Value = script.Parent.Recoil.Value + 1
end
fire(lookAt)
else
Reload()
break
end
elseif reloading == false and humanoid.Health < 1 then
Tool:remove()
end
end
Tool.Enabled = true
end

function nofiar(mouse)
firing = false
end

function onEquippedLocal(mouse)

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

mouse.Icon = "http://www.roblox.com/asset/?id=49912389"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.Button1Up:connect(function() nofiar(mouse) end)
mouse.KeyDown:connect(KeyDownFunctions)
while true do
wait()
end
end


Tool.Equipped:connect(onEquippedLocal)
Report Abuse
23134 is not online. 23134
Joined: 20 Dec 2011
Total Posts: 35
23 Jul 2014 10:06 PM
damage script

ball = script.Parent
damage = 50
local hitt = false

HitSound = Instance.new("Sound")
HitSound.Name = "HitSound"
HitSound.SoundId = "http://www.roblox.com/asset/?id=11945266"
HitSound.Pitch = .8
HitSound.Volume = 1
HitSound.Parent = ball

function onTouched(hit)
if hit.Parent:findFirstChild("ForceField") ~= nil then return end
if hit.CanCollide == false and hit.Parent:findFirstChild("Humanoid") or hit.Parent:findFirstChild("Zombie")== nil then return end
if hit.Parent.className == "Hat" and hitt == false then
hitt = true
hit:BreakJoints()
hit.Velocity = ball.Velocity
hit.Parent.Parent = game.Workspace
end

if hit:findFirstChild("Metal") ~= nil and hitt == false then
hitt = true
for i = 1,math.random(1,3) do
local j = Instance.new("Part")
j.formFactor = "Plate"
j.Size = Vector3.new(1,.4,1)
j.BrickColor = BrickColor.new("Bright yellow")
j.CanCollide = false
j.Velocity = v * 500
j.CFrame = script.Parent.CFrame
j.Parent = game.Workspace
end
end

local humanoid = hit.Parent:findFirstChild("Humanoid") or hit.Parent:findFirstChild("Zombie")

if humanoid ~= nil and hitt == false then
hitt = true
tagHumanoid(humanoid)
if hit.Name == "Head" then
humanoid.Health = humanoid.Health - damage * 2
elseif hit.Name == "Torso" then
humanoid.Health = humanoid.Health - damage * 1.5
else
humanoid.Health = humanoid.Health - damage
end
wait(.1)
untagHumanoid(humanoid)
end
if hitt == true then
HitSound:play()
ball.Parent = nil
end
end

function tagHumanoid(humanoid)
-- todo: make tag expire
local tag = ball:findFirstChild("creator")
if tag ~= nil then
local new_tag = tag:clone()
new_tag.Parent = humanoid
end
end


function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:GetChildren()

for i = 1, #tag do

if tag[i].Name == "creator" then
tag[i]:remove()
end

end
end
end

connection = ball.Touched:connect(onTouched)

while true do
wait(.01)
if damage < 0 then
break
else
damage = damage - .2
end
end

ball.Parent = nil
Report Abuse
ehern11 is not online. ehern11
Joined: 23 Apr 2011
Total Posts: 1541
23 Jul 2014 10:30 PM
this gave me reading problems
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