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: Game works in studio, but is barely effective in real server

Previous Thread :: Next Thread 
Apostasy is not online. Apostasy
Joined: 29 May 2008
Total Posts: 232
31 Aug 2014 08:19 PM
I made a zombie game with those advanced reloading animation guns. When I test in studio, it's smooth and everything seems to work.
When I play in a real server, the guns don't effect the zombie AIs (there's maybe a 1 in 100 chance that it does damage)
and the damage that is supposed to be taken from the zombies when touched is slow and delayed.

Everything else runs smooth without lag.
What could be wrong with the scripts (or anything) to be causing these problems?
Report Abuse
oscar9999991 is not online. oscar9999991
Joined: 15 Nov 2009
Total Posts: 11373
31 Aug 2014 08:28 PM
Can we see the scripts?
Report Abuse
Apostasy is not online. Apostasy
Joined: 29 May 2008
Total Posts: 232
31 Aug 2014 08:32 PM
Well, there's a lot of scripts inside models doing certain functions.


If it helps, here's just about all of the loose scripts in the game:

--I have about 10 of these scripts, serving as the spawns for different levels
do
wait(440)
r = game.Lighting.level5:Clone()
r.Parent = workspace
r:MakeJoints()
wait(100)
r:Remove()
end



------------------------------

--THIS IS a day/night script
L = Game:GetService("Lighting")


while true do
wait(.4)
T = L:GetMinutesAfterMidnight()
L:SetMinutesAfterMidnight(T + 1)
if T < 300 then --Night time, after midnight.
Game.Lighting.OutdoorAmbient = Color3.new(30/255,30/255,30/255)
elseif T > 300 and T < 390 then --Dawn, sun rise.
Game.Lighting.OutdoorAmbient = Color3.new((30+(T-300)/1.5)/255,(30+(T-300)/1.5)/255,(30+(T-300)/1.5)/255)
elseif T > 390 and T < 600 then --Morning.
Game.Lighting.OutdoorAmbient = Color3.new((90+(T-390)/7)/255,(90+(T-390)/7)/255,(90+(T-390)/7)/255)
elseif T > 600 and T < 840 then --Day time.
Game.Lighting.OutdoorAmbient = Color3.new(120/255,120/255,120/255)
elseif T > 840 and T < 1050 then --Afternoon.
Game.Lighting.OutdoorAmbient = Color3.new((120-(T-840)/7)/255,(120-(T-840)/7)/255,(120-(T-840)/7)/255)
elseif T > 1050 and T < 1140 then --Evening, sun set.
Game.Lighting.OutdoorAmbient = Color3.new((90-(T-1050)/1.5)/255,(90-(T-1050)/1.5)/255,(90-(T-1050)/1.5)/255)
elseif T > 1140 then --Night time, before midnight.
Game.Lighting.OutdoorAmbient = Color3.new(30/255,30/255,30/255)
end
end



--------------------
--Money leaderboard

print("Cash Stuffs running!")

function onPlayerEntered(newPlayer)
wait(.5)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"


local cash = Instance.new("IntValue")

cash.Name = "Money"
cash.Value = 1000 --Start Amount
cash.Parent = stats

stats.Parent = newPlayer
end

game.Players.ChildAdded:connect(onPlayerEntered)
Report Abuse
Apostasy is not online. Apostasy
Joined: 29 May 2008
Total Posts: 232
31 Aug 2014 08:36 PM
Okay, the main problem is the guns.

I tested one of the older standard "paintball shooter" guns, and they worked fine.

Here's the script for the new gun i'm using, if helpful.



ball = script.Parent
damage = math.random(1,1.2)
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("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 = Vector3.new(math.random(-10,10),math.random(-10,10),math.random(-10,10))
j.CFrame = script.Parent.CFrame
j.Parent = game.Workspace
end
end

local humanoid = 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
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
31 Aug 2014 08:37 PM
try removing local before variables if you have any
Report Abuse
Apostasy is not online. Apostasy
Joined: 29 May 2008
Total Posts: 232
31 Aug 2014 08:43 PM
Don't think I have any.
Report Abuse
brandon58590 is not online. brandon58590
Joined: 08 Mar 2008
Total Posts: 996
31 Aug 2014 08:46 PM
master why would you remove local variables?

apo, the guns shoot out bricks right?
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
31 Aug 2014 08:49 PM
if hit.Parent:findFirstChild("ForceField") ~= nil then return end
if hit.CanCollide == false and hit.Parent:findFirstChild("Zombie") == nil then return end
if hit.Parent.className == "Hat" and hitt == false then

im crying
Report Abuse
Apostasy is not online. Apostasy
Joined: 29 May 2008
Total Posts: 232
31 Aug 2014 08:56 PM
I'm crying too, because that didn't fix it D:


@brandon58590, I'm not 100% sure. I was thinking maybe these new weapons don't shoot bricks, and instead have some newer type of feature, idk.
But with the old "paintball shooter" gun that I know shoots bricks, it worked.
Report Abuse
Apostasy is not online. Apostasy
Joined: 29 May 2008
Total Posts: 232
31 Aug 2014 08:59 PM
Don't mean to advertise, but if somebody wants to see it for themselves in my game, thinking that might help, that would be cool.
Report Abuse
CrescentJade is not online. CrescentJade
Joined: 07 Jul 2010
Total Posts: 5494
31 Aug 2014 09:05 PM
u culd just forget tagging cause its useless...

connect = bullet.TouchedEnded:connect(function(hit)--to delay

if hit.Parent:findFirstChild("Human") then--assuming thats name of zombie
hit.Parent.Humanoid:TakeDamage(math.random(10,15))
end

end)

connect:disconnect()
Report Abuse
SpazzMan502 is not online. SpazzMan502
Joined: 01 Aug 2013
Total Posts: 2397
31 Aug 2014 09:08 PM
I tried remaking hanging fortresses

it worked fine in studio

but when i tried it out in a real game after 1 round it got fluffed up.
Report Abuse
Apostasy is not online. Apostasy
Joined: 29 May 2008
Total Posts: 232
31 Aug 2014 10:10 PM
Still need help.
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
31 Aug 2014 10:14 PM
Okay, I'm not going through all that, but the problem to me sounds like you are using local scripts without putting waits at the top. If that's the case, you should be putting a wait(1) or so at the top. Local scripts won't work without it in online mode, but will in offline mode.
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
31 Aug 2014 10:16 PM
or a wait()
Report Abuse
Apostasy is not online. Apostasy
Joined: 29 May 2008
Total Posts: 232
01 Sep 2014 12:35 PM
Well i'm pretty sure this is the only local script in each of the guns (and also the script that is supposed to shoot and do the damage to the ais)

If this is the case and this does need a wait() somewhere, where would it be?



ball = script.Parent
damage = math.random(1,1.2)
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("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 = Vector3.new(math.random(-10,10),math.random(-10,10),math.random(-10,10))
j.CFrame = script.Parent.CFrame
j.Parent = game.Workspace
end
end

local humanoid = 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
Apostasy is not online. Apostasy
Joined: 29 May 2008
Total Posts: 232
01 Sep 2014 12:40 PM
These are guns from free models that are used in public games against other players, they work fine. I don't understand why there is a problem with them in this game.
Report Abuse
MusicalGamer365 is not online. MusicalGamer365
Joined: 07 Feb 2012
Total Posts: 128
01 Sep 2014 01:08 PM
Post all the scripts and write what they're labeled. That should help.
Report Abuse
Apostasy is not online. Apostasy
Joined: 29 May 2008
Total Posts: 232
01 Sep 2014 01:13 PM
--BULLET--
ball = script.Parent
damage = math.random(1,1.2)
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("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 = Vector3.new(math.random(-10,10),math.random(-10,10),math.random(-10,10))
j.CFrame = script.Parent.CFrame
j.Parent = game.Workspace
end
end

local humanoid = 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
_________________________________

--GUISCIPT--

local Tool = script.Parent
local Ammo = Tool.Ammo
local MaxAmmo = Ammo.Value

local vPlayer
local Gui
local Text

function onChanged(value)
if value == "Value" or value == Ammo.Value then
if Gui ~= nil and Text ~= nil then
if Ammo.Value >= 1 then
Text.Text = ""..script.Parent.Ammo.Value.."|"..script.Parent.StoredAmmo.Value..""
elseif math.floor(Ammo.Value) == 0 then
Text.Text = ""..script.Parent.Ammo.Value.."|"..script.Parent.StoredAmmo.Value..""
elseif Ammo.Value < 0 then
for i = 0, 1, 0.03 / 2 do
local Num = math.floor(i * MaxAmmo + 0.5)

Text.Text = ""..script.Parent.Ammo.Value.."|"..script.Parent.StoredAmmo.Value..""
wait()
end
end
end
end
end

function on2Changed()
if Gui ~= nil and Text ~= nil then

Text.Text = ""..script.Parent.Ammo.Value.."|"..script.Parent.StoredAmmo.Value..""
wait()
end
end

function setUpGui()
if vPlayer == nil or vPlayer:findFirstChild("PlayerGui") == nil then
return
end

Gui = Instance.new("ScreenGui")
Text = Instance.new("TextLabel")

Gui.Name = "DEDisplay"
Gui.Parent = vPlayer.PlayerGui

Text.BackgroundColor3 = BrickColor.Black().Color
Text.BackgroundTransparency = 1
Text.BorderColor3 = BrickColor.White().Color
Text.BorderSizePixel = 0
Text.Name = "Ammo"
Text.Parent = Gui
Text.Position = UDim2.new(0.15, 0, 0.825, 0)
Text.Size = UDim2.new(0, -60, 0, 64)
Text.FontSize = "Size18"
Text.Text = ""..script.Parent.Ammo.Value.."|"..script.Parent.StoredAmmo.Value..""
Text.TextColor3 = BrickColor.White().Color
end

function onEquippedLocal(mouse)
vPlayer = game.Players.LocalPlayer

setUpGui()
end

function onUnequippedLocal(mouse)
if Gui then
Gui:remove()
end

Gui = nil
Text = nil
vPlayer = nil
end

Tool.Equipped:connect(onEquippedLocal)
Tool.Unequipped:connect(onUnequippedLocal)

Ammo.Changed:connect(onChanged)
Tool.StoredAmmo.Changed:connect(on2Changed)

__________________________

--SHOOTER--

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.115, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-91.5), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.05, math.rad(-87.5))
Tool.A1.Mesh.Offset = Vector3.new(0.075, 0, 0)
Tool.A2.Mesh.Offset = Vector3.new(0.075, 0, 0)
Tool.A3.Mesh.Offset = Vector3.new(0.075, 0, 0)
Tool.A4.Mesh.Offset = Vector3.new(0.075, 0, 0)
Tool.A5.Mesh.Offset = Vector3.new(0, -0.075, 0)
Tool.A6.Mesh.Offset = Vector3.new(0.075, 0, 0)
Tool.A7.Mesh.Offset = Vector3.new(0.075, 0, 0)
Tool.A8.Mesh.Offset = Vector3.new(0.075, 0, 0)
Tool.A9.Mesh.Offset = Vector3.new(0.075, 0, 0)
Tool.A10.Mesh.Offset = Vector3.new(0.075, 0, 0)
Tool.A11.Mesh.Offset = Vector3.new(0.075, 0, 0)
Tool.A12.Mesh.Offset = Vector3.new(0.075, 0, 0)
Tool.A13.Mesh.Offset = Vector3.new(0.075, 0, 0)
Tool.A14.Mesh.Offset = Vector3.new(0.075, 0, 0)
Tool.A15.Mesh.Offset = Vector3.new(0.075, 0, 0)
Tool.A16.Mesh.Offset = Vector3.new(0.075, 0, 0)
Tool.A17.Mesh.Offset = Vector3.new(0.075, 0, 0)
Tool.A18.Mesh.Offset = Vector3.new(0.075, 0, 0)
wait()
weld33.C1 = CFrame.new(-0.95, 0.13, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-93), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.1, math.rad(-85))
Tool.A1.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A2.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A3.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A4.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A5.Mesh.Offset = Vector3.new(0, -0.15, 0)
Tool.A6.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A7.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A8.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A9.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A10.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A11.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A12.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A13.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A14.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A15.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A16.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A17.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A18.Mesh.Offset = Vector3.new(0.15, 0, 0)
wait()
weld33.C1 = CFrame.new(-0.95, 0.145, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-94.5), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.15, math.rad(-82.5))
Tool.A1.Mesh.Offset = Vector3.new(0.225, 0, 0)
Tool.A2.Mesh.Offset = Vector3.new(0.225, 0, 0)
Tool.A3.Mesh.Offset = Vector3.new(0.225, 0, 0)
Tool.A4.Mesh.Offset = Vector3.new(0.225, 0, 0)
Tool.A5.Mesh.Offset = Vector3.new(0, -0.225, 0)
Tool.A6.Mesh.Offset = Vector3.new(0.225, 0, 0)
Tool.A7.Mesh.Offset = Vector3.new(0.225, 0, 0)
Tool.A8.Mesh.Offset = Vector3.new(0.225, 0, 0)
Tool.A9.Mesh.Offset = Vector3.new(0.225, 0, 0)
Tool.A10.Mesh.Offset = Vector3.new(0.225, 0, 0)
Tool.A11.Mesh.Offset = Vector3.new(0.225, 0, 0)
Tool.A12.Mesh.Offset = Vector3.new(0.225, 0, 0)
Tool.A13.Mesh.Offset = Vector3.new(0.225, 0, 0)
Tool.A14.Mesh.Offset = Vector3.new(0.225, 0, 0)
Tool.A15.Mesh.Offset = Vector3.new(0.225, 0, 0)
Tool.A16.Mesh.Offset = Vector3.new(0.225, 0, 0)
Tool.A17.Mesh.Offset = Vector3.new(0.225, 0, 0)
Tool.A18.Mesh.Offset = Vector3.new(0.225, 0, 0)
wait()
weld33.C1 = CFrame.new(-0.95, 0.16, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-96), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.2, math.rad(-80))
Tool.A1.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A2.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A3.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A4.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A5.Mesh.Offset = Vector3.new(0, -0.3, 0)
Tool.A6.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A7.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A8.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A9.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A10.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A11.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A12.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A13.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A14.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A15.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A16.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A17.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A18.Mesh.Offset = Vector3.new(0.3, 0, 0)
wait()
weld33.C1 = CFrame.new(-0.95, 0.175, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-97.5), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.25, math.rad(-77.5))
wait()
weld33.C1 = CFrame.new(-0.95, 0.19, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-99), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.3, math.rad(-75))
wait()
weld33.C1 = CFrame.new(-0.95, 0.205, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-100.5), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.35, math.rad(-72.5))
wait()
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-102), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.4, math.rad(-70))
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(.03)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-102), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.45, math.rad(-67.5))
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-102), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.5, math.rad(-65))
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-102), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.55, math.rad(-62.5))
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-102), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.6, math.rad(-60))
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-103), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.65, math.rad(-57.5))
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-103), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.7, math.rad(-55))
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-104), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.65, math.rad(-57.5))
wait(.1)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-104), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.6, math.rad(-60))
Tool.Mag.Transparency = 0
Tool.Mag2.Transparency = 0
Tool.Mag.Mesh.Offset = Vector3.new(-0.9, 0, 0)
Tool.Mag2.Mesh.Offset = Vector3.new(-0.9, 0, 0)
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-104), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.5, math.rad(-65))
Tool.Mag.Mesh.Offset = Vector3.new(-0.75, 0, 0)
Tool.Mag2.Mesh.Offset = Vector3.new(-0.75, 0, 0)
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-103), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.45, math.rad(-67.5))
Tool.Mag.Mesh.Offset = Vector3.new(-0.675, 0, 0)
Tool.Mag2.Mesh.Offset = Vector3.new(-0.675, 0, 0)
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-103), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.4, math.rad(-70))
Tool.Mag.Mesh.Offset = Vector3.new(-0.6, 0, 0)
Tool.Mag2.Mesh.Offset = Vector3.new(-0.6, 0, 0)
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-103), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.35, math.rad(-72.5))
Tool.Mag.Mesh.Offset = Vector3.new(-0.525, 0, 0)
Tool.Mag2.Mesh.Offset = Vector3.new(-0.525, 0, 0)
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-103), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.3, math.rad(-75))
Tool.Mag.Mesh.Offset = Vector3.new(-0.45, 0, 0)
Tool.Mag2.Mesh.Offset = Vector3.new(-0.45, 0, 0)
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-103), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.25, math.rad(-77.5))
Tool.Mag.Mesh.Offset = Vector3.new(-0.375, 0, 0)
Tool.Mag2.Mesh.Offset = Vector3.new(-0.375, 0, 0)
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-103), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.2, math.rad(-80))
Tool.Mag.Mesh.Offset = Vector3.new(-0.3, 0, 0)
Tool.Mag2.Mesh.Offset = Vector3.new(-0.3, 0, 0)
Tool.Handle.M2:play()
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-104), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.15, math.rad(-82.5))
Tool.Mag.Mesh.Offset = Vector3.new(-0.225, 0, 0)
Tool.Mag2.Mesh.Offset = Vector3.new(-0.225, 0, 0)
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-104), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.1, math.rad(-85))
Tool.Mag.Mesh.Offset = Vector3.new(-0.15, 0, 0)
Tool.Mag2.Mesh.Offset = Vector3.new(-0.15, 0, 0)
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-104), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), -0.05, math.rad(-87.5))
Tool.Mag.Mesh.Offset = Vector3.new(-0.075, 0, 0)
Tool.Mag2.Mesh.Offset = Vector3.new(-0.075, 0, 0)
wait(.03)
weld33.C1 = CFrame.new(-0.95, 0.22, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-104), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), 0, math.rad(-90))
Tool.Mag.Mesh.Offset = Vector3.new(0, 0, 0)
Tool.Mag2.Mesh.Offset = Vector3.new(0, 0, 0)
wait(.1)
weld33.C1 = CFrame.new(-0.95, 0.19, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-103), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), 0, math.rad(-90))
Tool.A1.Mesh.Offset = Vector3.new(0.25, 0, 0)
Tool.A2.Mesh.Offset = Vector3.new(0.25, 0, 0)
Tool.A3.Mesh.Offset = Vector3.new(0.25, 0, 0)
Tool.A4.Mesh.Offset = Vector3.new(0.25, 0, 0)
Tool.A5.Mesh.Offset = Vector3.new(0, -0.25, 0)
Tool.A6.Mesh.Offset = Vector3.new(0.25, 0, 0)
Tool.A7.Mesh.Offset = Vector3.new(0.25, 0, 0)
Tool.A8.Mesh.Offset = Vector3.new(0.25, 0, 0)
Tool.A9.Mesh.Offset = Vector3.new(0.25, 0, 0)
Tool.A10.Mesh.Offset = Vector3.new(0.25, 0, 0)
Tool.A11.Mesh.Offset = Vector3.new(0.25, 0, 0)
Tool.A12.Mesh.Offset = Vector3.new(0.25, 0, 0)
Tool.A13.Mesh.Offset = Vector3.new(0.25, 0, 0)
Tool.A14.Mesh.Offset = Vector3.new(0.25, 0, 0)
Tool.A15.Mesh.Offset = Vector3.new(0.25, 0, 0)
Tool.A16.Mesh.Offset = Vector3.new(0.25, 0, 0)
Tool.A17.Mesh.Offset = Vector3.new(0.25, 0, 0)
Tool.A18.Mesh.Offset = Vector3.new(0.25, 0, 0)
Tool.Handle.M3.Volume = 2
Tool.Handle.M3:play()
wait()
weld33.C1 = CFrame.new(-0.95, 0.16, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-98), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), 0, math.rad(-90))
Tool.A1.Mesh.Offset = Vector3.new(0.2, 0, 0)
Tool.A2.Mesh.Offset = Vector3.new(0.2, 0, 0)
Tool.A3.Mesh.Offset = Vector3.new(0.2, 0, 0)
Tool.A4.Mesh.Offset = Vector3.new(0.2, 0, 0)
Tool.A5.Mesh.Offset = Vector3.new(0, -0.2, 0)
Tool.A6.Mesh.Offset = Vector3.new(0.2, 0, 0)
Tool.A7.Mesh.Offset = Vector3.new(0.2, 0, 0)
Tool.A8.Mesh.Offset = Vector3.new(0.2, 0, 0)
Tool.A9.Mesh.Offset = Vector3.new(0.2, 0, 0)
Tool.A10.Mesh.Offset = Vector3.new(0.2, 0, 0)
Tool.A11.Mesh.Offset = Vector3.new(0.2, 0, 0)
Tool.A12.Mesh.Offset = Vector3.new(0.2, 0, 0)
Tool.A13.Mesh.Offset = Vector3.new(0.2, 0, 0)
Tool.A14.Mesh.Offset = Vector3.new(0.2, 0, 0)
Tool.A15.Mesh.Offset = Vector3.new(0.2, 0, 0)
Tool.A16.Mesh.Offset = Vector3.new(0.2, 0, 0)
Tool.A17.Mesh.Offset = Vector3.new(0.2, 0, 0)
Tool.A18.Mesh.Offset = Vector3.new(0.2, 0, 0)
wait()
weld33.C1 = CFrame.new(-0.95, 0.13, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-94), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), 0, math.rad(-90))
Tool.A1.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A2.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A3.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A4.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A5.Mesh.Offset = Vector3.new(0, -0.15, 0)
Tool.A6.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A7.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A8.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A9.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A10.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A11.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A12.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A13.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A14.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A15.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A16.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A17.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A18.Mesh.Offset = Vector3.new(0.15, 0, 0)
wait()
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))
Tool.A1.Mesh.Offset = Vector3.new(0.1, 0, 0)
Tool.A2.Mesh.Offset = Vector3.new(0.1, 0, 0)
Tool.A3.Mesh.Offset = Vector3.new(0.1, 0, 0)
Tool.A4.Mesh.Offset = Vector3.new(0.1, 0, 0)
Tool.A5.Mesh.Offset = Vector3.new(0, -0.1, 0)
Tool.A6.Mesh.Offset = Vector3.new(0.1, 0, 0)
Tool.A7.Mesh.Offset = Vector3.new(0.1, 0, 0)
Tool.A8.Mesh.Offset = Vector3.new(0.1, 0, 0)
Tool.A9.Mesh.Offset = Vector3.new(0.1, 0, 0)
Tool.A10.Mesh.Offset = Vector3.new(0.1, 0, 0)
Tool.A11.Mesh.Offset = Vector3.new(0.1, 0, 0)
Tool.A12.Mesh.Offset = Vector3.new(0.1, 0, 0)
Tool.A13.Mesh.Offset = Vector3.new(0.1, 0, 0)
Tool.A14.Mesh.Offset = Vector3.new(0.1, 0, 0)
Tool.A15.Mesh.Offset = Vector3.new(0.1, 0, 0)
Tool.A16.Mesh.Offset = Vector3.new(0.1, 0, 0)
Tool.A17.Mesh.Offset = Vector3.new(0.1, 0, 0)
Tool.A18.Mesh.Offset = Vector3.new(0.1, 0, 0)
wait()
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.05, math.rad(-87.5))
Tool.A1.Mesh.Offset = Vector3.new(0.05, 0, 0)
Tool.A2.Mesh.Offset = Vector3.new(0.05, 0, 0)
Tool.A3.Mesh.Offset = Vector3.new(0.05, 0, 0)
Tool.A4.Mesh.Offset = Vector3.new(0.05, 0, 0)
Tool.A5.Mesh.Offset = Vector3.new(0, -0.05, 0)
Tool.A6.Mesh.Offset = Vector3.new(0.05, 0, 0)
Tool.A7.Mesh.Offset = Vector3.new(0.05, 0, 0)
Tool.A8.Mesh.Offset = Vector3.new(0.05, 0, 0)
Tool.A9.Mesh.Offset = Vector3.new(0.05, 0, 0)
Tool.A10.Mesh.Offset = Vector3.new(0.05, 0, 0)
Tool.A11.Mesh.Offset = Vector3.new(0.05, 0, 0)
Tool.A12.Mesh.Offset = Vector3.new(0.05, 0, 0)
Tool.A13.Mesh.Offset = Vector3.new(0.05, 0, 0)
Tool.A14.Mesh.Offset = Vector3.new(0.05, 0, 0)
Tool.A15.Mesh.Offset = Vector3.new(0.05, 0, 0)
Tool.A16.Mesh.Offset = Vector3.new(0.05, 0, 0)
Tool.A17.Mesh.Offset = Vector3.new(0.05, 0, 0)
Tool.A18.Mesh.Offset = Vector3.new(0.05, 0, 0)
wait()
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.1, math.rad(-85))
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)
wait()
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.05, math.rad(-87.5))
wait()
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))
end

function Reload()
if script.Parent.Ammo.Value < script.Parent.MaxAmmo.Value and reloading == false and script.Parent.StoredAmmo.Value >= 1 then
reloading = true
script.Parent.Ammo.Value = 0
ReloadSequence()
-- ...
if script.Parent.StoredAmmo.Value >= script.Parent.MaxAmmo.Value then
script.Parent.Ammo.Value = script.Parent.MaxAmmo.Value
script.Parent.StoredAmmo.Value = script.Parent.StoredAmmo.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 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(-94), 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))
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 = Instance.new("BlockMesh")
mesh1.Scale = Vector3.new(.9,.9,.9)
mesh1.Parent = falsearm1
local armweld1 = Instance.new("Weld")
falsearm1.BrickColor = BrickColor.new(26)
falsearm1.Parent = Tool
armweld1.Parent = falsearm1
armweld1.Part0 = falsearm1
armweld1.Part1 = arms[1]
falsearm2 = arms[2]:clone()
local mesh2 = Instance.new("BlockMesh")
mesh2.Scale = Vector3.new(.9,.9,.9)
mesh2.Parent = falsearm2
local armweld2 = Instance.new("Weld")
falsearm2.BrickColor = BrickColor.new(26)
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), 0, 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(-90), 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 * 8)

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.002, 0.002, 0)
cam.CoordinateFrame = ncf*CFrame.new(0, 0, cam_scroll)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-96), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), 0.07, math.rad(-90))
Tool.Flash.Mesh.Scale = Vector3.new(1.1, 1.4, 1.1)
Tool.Flash.Transparency = .4
Tool.A1.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A2.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A3.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A4.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A5.Mesh.Offset = Vector3.new(0, -0.15, 0)
Tool.A6.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A7.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A8.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A9.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A10.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A11.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A12.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A13.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A14.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A15.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A16.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A17.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A18.Mesh.Offset = Vector3.new(0.15, 0, 0)
wait(.02)
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.002, -0.002, 0)
cam.CoordinateFrame = ncf*CFrame.new(0, 0, cam_scroll)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-102), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), 0.14, math.rad(-90))
Tool.Flash.Mesh.Scale = Vector3.new(1.4, 1.7, 1.4)
Tool.Flash.Transparency = .5
Tool.A1.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A2.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A3.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A4.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A5.Mesh.Offset = Vector3.new(0, -0.3, 0)
Tool.A6.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A7.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A8.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A9.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A10.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A11.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A12.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A13.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A14.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A15.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A16.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A17.Mesh.Offset = Vector3.new(0.3, 0, 0)
Tool.A18.Mesh.Offset = Vector3.new(0.3, 0, 0)
wait(.04)
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.002, 0.002, 0)
cam.CoordinateFrame = ncf*CFrame.new(0, 0, cam_scroll)
weld33.C1 = CFrame.new(-0.95, 0.1, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-96), math.rad(-25), 0)
weld55.C1 = CFrame.new(-0.25, 0.2, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(320), 0.07, math.rad(-90))
Tool.Flash.Mesh.Scale = Vector3.new(1.1, 1.4, 1.1)
Tool.Flash.Transparency = .8
Tool.A1.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A2.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A3.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A4.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A5.Mesh.Offset = Vector3.new(0, -0.15, 0)
Tool.A6.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A7.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A8.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A9.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A10.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A11.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A12.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A13.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A14.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A15.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A16.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A17.Mesh.Offset = Vector3.new(0.15, 0, 0)
Tool.A18.Mesh.Offset = Vector3.new(0.15, 0, 0)
wait(.02)
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.002, -0.002, 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, math.rad(-90))
Tool.Flash.Transparency = 1
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)
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
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 < 20 then
script.Parent.Recoil.Value = script.Parent.Recoil.Value + math.random(1,3)
end
fire(lookAt)
else
Reload()
end
end
Tool.Enabled = true
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.KeyDown:connect(KeyDownFunctions)
while true do
wait()
end
end


Tool.Equipped:connect(onEquippedLocal)


script.Parent.Activated:connect(onActivated)
Tool.Equipped:connect(Equip)
Tool.Unequipped:connect(Unequip)
_________________________________

--This script is inside a NumberValue called Recoil--
while true do
wait(.4)
if script.Parent.Value > 12 then
script.Parent.Value = script.Parent.Value - 1
end
end

Report Abuse
Apostasy is not online. Apostasy
Joined: 29 May 2008
Total Posts: 232
01 Sep 2014 01:14 PM
The only other script is a weld script.
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
01 Sep 2014 01:19 PM
add a wait() at the top
Report Abuse
MusicalGamer365 is not online. MusicalGamer365
Joined: 07 Feb 2012
Total Posts: 128
01 Sep 2014 01:19 PM
In the bullet script near the end there is a

connection =

Part of the script. Try deleting that.
Report Abuse
Apostasy is not online. Apostasy
Joined: 29 May 2008
Total Posts: 232
01 Sep 2014 01:27 PM
Nothing. :/
I don't get it.
Report Abuse
MusicalGamer365 is not online. MusicalGamer365
Joined: 07 Feb 2012
Total Posts: 128
01 Sep 2014 01:49 PM
In the gun script you will see something like this:


spawnPos = spawnPos + (v * 8)

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




Replace it with this:




spawnPos = spawnPos + (v * 8)

missile.Position = spawnPos
missile.Size = Vector3.new(1,196,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,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






Hope this works and helps
Report Abuse
Apostasy is not online. Apostasy
Joined: 29 May 2008
Total Posts: 232
15 Sep 2014 05:23 PM
Very delayed response, but in response to musicalgamer, that didn't work.
Anyone who can figure this out is greatly appreciated.
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