Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 18 Aug 2012 10:10 AM |
Hello, me again. This time I am having issues with a Shotgun script. I get this error in the output whenever I try to fire:
Workspace.Player.Shotgun.Slugs:357: attempt to concatenate local 'startpoint' (a userdata value) 10:26:21 - Script "Workspace.Player.Shotgun.Slugs", Line 357 - global onButton1Down 10:26:21 - Script "Workspace.Player.Shotgun.Slugs", Line 395 10:26:21 - stack end 10:26:21 - Disconnected event because of exception
'Slugs' is the name of the script that makes the shotgun fire. There is another one called Shot that will change to Active once I press a certain key. However, that shouldn't be the issue. What I've did in the scripts for the Automatic weapons is change local startpoint=sp.Handle.CFrame*BarrlePos to local startpoint=sp.Barrel.Position.
This is WIJ technology by the way. I'm just having a little fun experimenting with it. I take no credit.
It's a pretty large code chunk, (apologies in advance) however most of it is necessary to fix the problem. It will be much easier if you copy and paste it into a script to read it. I hope someone can take the time to help.
This chunk starts at line 357, and ends at line 453.
If you think you may be able to help me out, PM me and I will send you a copy of the code. |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
| |
|
|
| 18 Aug 2012 10:42 AM |
Let mercy come, and wash away, ... ^^^
Yeah, you are concatenating a userdata value. Like this:
workspace.Brick.." is a brick!" |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 19 Aug 2012 08:00 AM |
| Ah, so what should I do to fix the issue? |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 19 Aug 2012 08:14 AM |
Guess this is a simple error. So.. bump.
Pointers? |
|
|
| Report Abuse |
|
|
HuntHello
|
  |
| Joined: 19 Jan 2011 |
| Total Posts: 577 |
|
|
| 19 Aug 2012 08:20 AM |
| Post the script from 350 to 390 |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 19 Aug 2012 08:46 AM |
| that's because now the startpoint is a vector3 instead of CFrame |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 19 Aug 2012 03:32 PM |
This is line 347 to line 392. Basically what want to do is change the start position of the bullet to the position of the gun barrel.
if burst then local startpoint=sp.Handle.CFrame*BarrlePos local mag=(mouse.Hit.p-startpoint).magnitude local rndm=Vector3.new(math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag)) fire(mouse.Hit.p+rndm) Charge.Value=Charge.Value+math.random(chargeperfireMIN, chargeperfireMAX) if Charge.Value>=MaxCharge then break end wait(.05) local startpoint=sp.Handle.CFrame*BarrlePos local mag2=((mouse.Hit.p+rndm)-startpoint).magnitude local rndm2=Vector3.new(math.random(-(.1/10)*mag2,(.1/10)*mag2),math.random(-(.1/10)*mag2,(.1/10)*mag2),math.random(-(.1/10)*mag2,(.1/10)*mag2)) fire(mouse.Hit.p+rndm+rndm2) Charge.Value=Charge.Value+math.random(chargeperfireMIN, chargeperfireMAX) if Charge.Value>=MaxCharge then break end wait(.05) fire(mouse.Hit.p+rndm+rndm2+rndm2) Charge.Value=Charge.Value+math.random(chargeperfireMIN, chargeperfireMAX) elseif shot then Charge.Value=Charge.Value+math.random(chargeperfireMIN, chargeperfireMAX) local startpoint=sp.Handle.CFrame*BarrlePos local mag=(mouse.Hit.p-startpoint).magnitude local rndm=Vector3.new(math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag)) fire(mouse.Hit.p+rndm) local mag2=((mouse.Hit.p+rndm)-startpoint).magnitude local rndm2=Vector3.new(math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2)) fire(mouse.Hit.p+rndm+rndm2) local rndm3=Vector3.new(math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2)) fire(mouse.Hit.p+rndm+rndm3) local rndm4=Vector3.new(math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2)) fire(mouse.Hit.p+rndm+rndm4) else Charge.Value=Charge.Value+math.random(chargeperfireMIN, chargeperfireMAX) local startpoint=sp.Handle.CFrame*BarrlePos local mag=(mouse.Hit.p-startpoint).magnitude local rndm=Vector3.new(math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag)) fire(mouse.Hit.p+rndm) end wait(Firerate) if not automatic then break end end |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
| |
|