theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 24 Sep 2011 12:34 AM |
Meh very first weapon made from scratch.
23: bad argument #1 to '?' (Vector3 expected, got table)
tool=script.Parent local user
tool.Equipped:connect(function(mouse) user=tool.Parent mouse.Button1Down:connect(function() local ray = Ray.new(tool.Barrel.CFrame.p, (mouse.Hit.p-tool.Barrel.CFrame.p).unit*300) local hit, position=game.Workspace:FindPartOnRay(ray,user) if hit then if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid:TakeDamage(30) end local RayPart = Instance.new("Part",User) RayPart.Name = "RayPart" RayPart.BrickColor = BrickColor.new("Bright red") RayPart.Transparency = 0.5 RayPart.Anchored = true RayPart.CanCollide = false RayPart.TopSurface = Enum.SurfaceType.Smooth RayPart.BottomSurface = Enum.SurfaceType.Smooth RayPart.formFactor = Enum.FormFactor.Custom local Distance = (CFrame-tool.Handle.CFrame.p).magnitude --PROBLEM RayPart.Size = Vector3.new(0.2,0.2,Distance) RayPart.CFrame = CFrame.new(Position,tool.Handle.CFrame.p) * CFrame.new(0,0,-Distance/2) game.Debris:AddItem(RayPart,0.1) end end) end)
And this weld script works kinda. Explodes then welds.
tool=script.Parent
function pie() for i,v in pairs(tool:GetChildren()) do if v:IsA("BasePart") then local w = Instance.new("Weld") w.Parent = tool.Handle w.Part0 = tool.Handle w.Part1 = v w.C0 = v.CFrame:inverse() w.C1 = v.CFrame:inverse() end for i,v in pairs(tool:GetChildren()) do if (v.className=="Part" or v.className=="WedgePart" or v.className=="CornerWedgePart") then v.Anchored=false end end end end
tool.Equipped:connect(pie) tool.Unequipped:connect(pie)
"Death to lazy builders. Remove the CFrame tools. Command bar all the way"~pauljkl "If it tastes bad, it's probably healthy" -RadioactiveWafflez |
|
|
| Report Abuse |
|
|
Shobobo99
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 5754 |
|
|
| 24 Sep 2011 12:39 AM |
I don't see any CFrame variable.. but I think you meant to do this:
local Distance = (position-tool.Handle.CFrame.p).magnitude |
|
|
| Report Abuse |
|
|
theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 24 Sep 2011 12:43 AM |
Ok now 25 has the same problem.
"Death to lazy builders. Remove the CFrame tools. Command bar all the way"~pauljkl "If it tastes bad, it's probably healthy" -RadioactiveWafflez |
|
|
| Report Abuse |
|
|
Shobobo99
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 5754 |
|
|
| 24 Sep 2011 12:54 AM |
| Change Position to position. |
|
|
| Report Abuse |
|
|
theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 24 Sep 2011 12:58 AM |
Now it just doesn't fire. And weld is still screwed up.Thanks so far!
"Death to lazy builders. Remove the CFrame tools. Command bar all the way"~pauljkl "If it tastes bad, it's probably healthy" -RadioactiveWafflez |
|
|
| Report Abuse |
|
|
Shobobo99
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 5754 |
|
|
| 24 Sep 2011 01:05 AM |
| Before welding the parts (which would be before equipping them) MAKE SURE they are anchored. |
|
|
| Report Abuse |
|
|
theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 24 Sep 2011 01:08 AM |
Yeah they are Anchored.
"Death to lazy builders. Remove the CFrame tools. Command bar all the way"~pauljkl "If it tastes bad, it's probably healthy" -RadioactiveWafflez |
|
|
| Report Abuse |
|
|
Fredfishy
|
  |
| Joined: 21 Mar 2009 |
| Total Posts: 4197 |
|
|
| 24 Sep 2011 01:42 AM |
| You spelt "position" with a capital on the second line :| |
|
|
| Report Abuse |
|
|
theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 24 Sep 2011 01:44 AM |
Yeah I got all that just troubles with firing nao.
"Death to lazy builders. Remove the CFrame tools. Command bar all the way"~pauljkl "If it tastes bad, it's probably healthy" -RadioactiveWafflez |
|
|
| Report Abuse |
|
|