null
nil
-
true
0
-0.400000006
-0
1
-0
0
0
1
-5.99999985e-005
0
5.99999985e-005
1
M9
true
-
Ammo
12
true
-
false
GunScript
originalAmmo = script.Parent.Ammo.Value
m = Instance.new("Message")
function computeDirection(vec)
local lenSquared = vec.magnitude^2
local invSqrt = 1 / math.sqrt(lenSquared)
return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
end
function updateAmmo()
m.Text = " "
--for i = 1,script.Parent.Ammo.Value do
-- m.Text = m.Text .. "|"
--end
--for i = 1, (originalAmmo - script.Parent.Ammo.Value) do
-- m.Text = m.Text .. " "
--end
m.Text = m.Text .. " " .. script.Parent.Ammo.Value.. "/" ..originalAmmo
end
function fire(v)
script.Parent.Handle.Fire:play()
script.Parent.Ammo.Value = script.Parent.Ammo.Value - 1
updateAmmo()
local dir = v - script.Parent["Handle"].Position
dir = computeDirection(dir)
local pos = script.Parent["Handle"].Position + (dir * 8)
local p = Instance.new("Part")
p.Name = "Projectile"
p.CFrame = CFrame.new(pos, pos + dir)
p.BrickColor = BrickColor.new(24)
p.Reflectance = 0.1
p.Velocity = (script.Parent.Parent["Head"].Position - v).unit * -150
p.Size = Vector3.new(1, 0.4, 1)
p.formFactor = 2
local mesh = script.Parent.Mesh:clone()
mesh.Parent = p
local upforce = Instance.new("BodyForce")
upforce.force = Vector3.new(0, p:GetMass() * 196, 0)
upforce.Parent = p
local s = script.Parent["ProjectileScript"]:Clone()
s.Disabled = false
s.Parent = p
p.Parent = game.Workspace
wait(0)
end
function onKeyDown(key)
if (key~=nil) then
key = key:lower()
if (key=="r") then
script.Parent.Ammo.Value = originalAmmo
script.Parent.Handle.Reload:play()
m.Text = "Reloading."
for i =1,5 do
wait(0.22)
m.Text = m.Text .. "."
updateAmmo()
end
end
end
end
function onActivated()
if script.Parent.Enabled == true then
--script.Parent.Enabled = false
if script.Parent.Ammo.Value > 0 then
fire(script.Parent.Parent["Humanoid"].TargetPoint)
else
if script.Parent.Clips.Value >= -30000000000000 then
script.Parent.Enabled = false
script.Parent.Handle.Reload:play()
m.Text = "Reloading."
for i =1,5 do
wait(0.22)
m.Text = m.Text .. "."
end
script.Parent.Clips.Value = script.Parent.Clips.Value - 1
script.Parent.Ammo.Value = originalAmmo
updateAmmo()
script.Parent.Enabled = true
else
m.Text = "No more clips!"
end
end
wait(0.16)
--script.Parent.Enabled = true
end
end
function onEquipped()
local p = game.Players:GetChildren()
for i = 1,#p do
if p[i].Character == script.Parent.Parent then
m.Parent = p[i]
end
end
updateAmmo()
end
function onUnequipped()
m.Parent = nil
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
script.Parent.Unequipped:connect(onUnequipped)
mouse.KeyDown:connect(onKeyDown)
true
-
true
ProjectileScript
damage = 89
game:GetService("Debris"):AddItem(script.Parent, 8)
function onTouched(hit)
if hit.Parent:findFirstChild("Humanoid")~=nil then
hit.Parent["Humanoid"]:TakeDamage(damage)
end
wait()
script.Parent:Remove()
end
script.Parent.Touched:connect(onTouched)
true
-
false
Local 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(0.4)
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.Equipped:connect(onEquippedLocal)
true
-
Clips
6
true
-
false
-0.5
0.5
0
0
-0.5
0.5
4
0
194
-58.5
63
-238
1
0
0
0
1
0
0
0
1
true
false
0.5
1
0.300000012
-0.5
0.5
4
0
-0.5
0.5
0
0
false
256
Handle
0.5
-0.5
0.5
0
0
0
0
0
-0.5
0.5
0
0
0
0
0
0
true
1
1
1.20000005
2
-
false
Reload
1
-1
false
http://www.roblox.com/asset/?id=2697432
1
true
-
false
Fire
1
-1
false
http://www.roblox.com/asset/?id=2697431
1
true
-
true
activate script
wait(.5)
print("1")
local Tool = script.Parent
print("1")
enabled = true
print("1")
function onEquippedLocal(mouse)
--function onSelected(mouse)
print("1")
mouse.Icon = "rbxasset://textures\\GunCursor.png"
print("1")
mouse.KeyDown:connect(onKeyDown)
print("1")
end
print("1")
function onKeyDown(key)
if (key~=nil) then
key = key:lower()
if (key=="r") then
script.Parent.Ammo.Value = 12
end
end
end
Tool.Equipped:connect(onEquippedLocal)
--bin.Equipped:connect(onEquipped)
--bin.Selected:connect(onSelected)
true
-
2
2
http://www.roblox.com/asset/?id=2697549
5
Mesh
0
0
0
1
1
1
http://www.roblox.com/asset/?id=2697544
1
1
1
true