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: Need help on a script. (non-working script)

Previous Thread :: Next Thread 
AeLiSTaS3 is not online. AeLiSTaS3
Joined: 02 Jan 2010
Total Posts: 4918
03 Aug 2012 07:20 PM
So I took Stick's paintball gun and wanted to add reloading animation and muzzleflash. The muzzleflash works, but the script doesn't because of the reloading animation (I think). Can someone tell me what did I do wrong here?

--Made by Stickmasterluke
--AeLiSTaS3's version (reloading animation, improved animation, muzzleflash billboard gui)

sp=script.Parent

rate=1/30
spreadpercentoffset=.5


----Gun statistics----
automatic=false
burst=true
shotgun=false

range=2000 --can be any realistic number, even over 1000
firerate=.1
damage=22

reloadtime=3
startingammo=120
maxammo=2000
clipsize=30
noclip=false
unlimitedammo=false

minspread=.5
maxspread=2
spreadincrease=.05
spreadcooldowntime=1
----------------------

function waitfor(a,b)
while a:FindFirstChild(b)==nil do
wait()
end
end

local weld33 = nil -- right arm
local weld55 = nil -- left arm
waitfor(sp,"Aim")
waitfor(sp,"Spread")
waitfor(sp,"HitTarget")
waitfor(sp,"WeaponHud")
waitfor(sp,"Handle")
local gun=sp.Handle
waitfor(gun,"FireSound")
waitfor(gun,"M1")
waitfor(gun,"M2")

ammo=startingammo
ammoinclip=clipsize
spread=minspread
equipped=false
reloading=false
down=false
ready=true
local gui=sp.WeaponHud
local debris=game:GetService("Debris")
while plr==nil do
plr=game.Players.LocalPlayer
end

function updateammo(additional)
additional=additional or 0
if noclip then
if not unlimitedammo then
ammo=ammo+additional
if ammo<0 then
ammo=0
elseif ammo>maxammo then
ammo=maxammo
end
end
else
ammoinclip=ammoinclip+additional
if ammoinclip<0 then
ammoinclip=0
elseif ammoinclip>clipsize then
ammoinclip=clipsize
end
end
--ammo gui update
if gui then
gui.AmmoHud.TotalAmmo.Text=tostring(ammo)
gui.AmmoHud.ClipAmmo.Text=tostring(ammoinclip)
end
end

function reload() --reloading animation (AeLiSTaS3's version help here)
if not reloading and ready and equipped then
reloading=true
if gui then
gui.ReloadingLabel.Visible=true
weld33.C1 = CFrame.new(-0.75, -0.4, 0.4) * CFrame.fromEulerAnglesXYZ(math.rad(-93), math.rad(-15), 0.1)
weld55.C1 = CFrame.new(-0.46, 1.3, 0.575) * CFrame.fromEulerAnglesXYZ(math.rad(295), 0, math.rad(-90))
wait(.04)
weld33.C1 = CFrame.new(-0.75, -0.4, 0.45) * CFrame.fromEulerAnglesXYZ(math.rad(-96), math.rad(-15), 0.2)
weld55.C1 = CFrame.new(-0.46, 1.2, 0.55) * CFrame.fromEulerAnglesXYZ(math.rad(300), 0, math.rad(-90))
wait(.04)
weld33.C1 = CFrame.new(-0.75, -0.4, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(-99), math.rad(-15), 0.3)
weld55.C1 = CFrame.new(-0.46, 1.1, 0.525) * CFrame.fromEulerAnglesXYZ(math.rad(305), 0, math.rad(-90))
wait(.04)
weld55.C1 = CFrame.new(-0.46, 1.1, 0.525) * CFrame.fromEulerAnglesXYZ(math.rad(305), -0.1, math.rad(-90))
sp.Mag.Transparency = 1
local mag = sp.Mag:clone()
mag.Parent = game.Workspace
mag.CanCollide = false
mag.Transparency = 0
sp.Handle.M1:play()
wait(.04)
weld55.C1 = CFrame.new(-0.46, 1.1, 0.525) * CFrame.fromEulerAnglesXYZ(math.rad(305), -0.2, math.rad(-90))
wait(.04)
weld55.C1 = CFrame.new(-0.46, 1.1, 0.525) * CFrame.fromEulerAnglesXYZ(math.rad(305), -0.3, math.rad(-90))
wait(.04)
weld55.C1 = CFrame.new(-0.46, 1.1, 0.525) * CFrame.fromEulerAnglesXYZ(math.rad(305), -0.4, math.rad(-90))
wait(.04)
weld55.C1 = CFrame.new(-0.46, 1.1, 0.525) * CFrame.fromEulerAnglesXYZ(math.rad(305), -0.5, math.rad(-90))
wait(.04)
weld55.C1 = CFrame.new(-0.46, 1.1, 0.525) * CFrame.fromEulerAnglesXYZ(math.rad(305), -0.6, math.rad(-90))
wait(.3)
sp.Mag.Transparency = 0
sp.Mag.Mesh.Offset = Vector3.new(0, -0.5, 0)
wait(.1)
weld55.C1 = CFrame.new(-0.46, 1.1, 0.525) * CFrame.fromEulerAnglesXYZ(math.rad(305), -0.35, math.rad(-90))
sp.Mag.Mesh.Offset = Vector3.new(0, -0.25, 0)
sp.Handle.M2:play()
wait(.1)
weld55.C1 = CFrame.new(-0.46, 1.1, 0.525) * CFrame.fromEulerAnglesXYZ(math.rad(305), -0.1, math.rad(-90))
sp.Mag.Mesh.Offset = Vector3.new(0, 0, 0)
wait(.2)
weld55.C1 = CFrame.new(-0.46, 1.1, 0.525) * CFrame.fromEulerAnglesXYZ(math.rad(305), -0.05, math.rad(-90))
wait(0.07)
weld33.C1 = CFrame.new(-0.75, -0.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0.15)
weld55.C1 = CFrame.new(-0.45, 1.25, 0.5575) * CFrame.fromEulerAnglesXYZ(math.rad(290), -0.025, math.rad(-90))
wait(0.07)
weld33.C1 = CFrame.new(-0.75, -0.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
weld55.C1 = CFrame.new(-0.45, 1.4, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
wait(reloadtime)
if unlimitedammo then
ammo=clipsize
else
local extraammo=clipsize-ammoinclip
if ammo>=extraammo then
ammo=ammo-extraammo
ammoinclip=clipsize
else
ammoinclip=ammo
ammo=0
end
end
if gui then
gui.ReloadingLabel.Visible=false
end
reloading=false
end
updateammo(0)
end

function hittarget()
if gui then
delay(0,function()
if gui:FindFirstChild("TargetHitImage") then
gui.TargetHitImage.Visible=true
local lth=tick()
lasttargethit=lth
wait(.5)
if lasttargethit<=lth then
gui.TargetHitImage.Visible=false
end
end
end)
end
end
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
03 Aug 2012 07:27 PM
..Make this your self. then add the CFrame.
Report Abuse
AeLiSTaS3 is not online. AeLiSTaS3
Joined: 02 Jan 2010
Total Posts: 4918
03 Aug 2012 07:29 PM
I don't get it.
Report Abuse
AeLiSTaS3 is not online. AeLiSTaS3
Joined: 02 Jan 2010
Total Posts: 4918
03 Aug 2012 07:39 PM
bump.
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