|
| 22 Jul 2013 04:21 AM |
Ok, basically, I'm using Raycasting in the weapons for one of my games, but there's a slight problem. The line that constructs the ray executes fine, as far as I can tell. However; the script just stops after that line. Not even an error. The line is below:
local AnimHit,AnimPos = game.Workspace:FindPartOnRay(Ray.new(Weapon.Handle.CFrame.p*BarrelPos, (mouse.Hit.p - (Weapon.Handle.CFrame.p*BarrelPos)).unit*500),Tool)
I tried without .unit, changing the multiplier... but nothing works. Could someone please tell me what's wrong?
~Kierantech909 |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2013 04:25 AM |
| Remove the .p from the CFrame where e unit is. |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2013 04:33 AM |
It still doesn't seem to execute the rest of the script...
~Kierantech909 |
|
|
| Report Abuse |
|
|
| |
|
|
| 22 Jul 2013 05:06 AM |
Ok, here's the entire section:
function animatebullet() print("Before Ray: OK") local AnimHit,AnimPos = game.Workspace:FindPartOnRay(Ray.new(Weapon.Handle.CFrame*BarrelPos, (mouse.Hit.p - (Weapon.Handle.CFrame*BarrelPos)).unit*500),Tool) print("After Ray: OK") local expl = Instance.new("Explosion",Tool) local explpos = Instance.new("Vector3Value",Tool) local mhit = mouse.Hit expl.Position = Vector3.new(AnimPos.X,AnimPos.Y,AnimPos.Z) explpos.Value = Vector3.new(AnimPos.X,AnimPos.Y,AnimPos.Z) expl.BlastRadius = HitRadius expl.BlastPressure = 0 expl.Hit:connect(function(part,partdist) local distfactor = partdist/HitRadius distfactor = 1 - distfactor hitlist[#hitlist+1] = part hitdistlist[#hitdistlist+1] = distfactor end) print("After Expl: OK") if mouse.Target.Parent:FindFirstChild("Humanoid") and game.Players:GetPlayerFromCharacter(mouse.Target.Parent) then local splr = game.Players:GetPlayerFromCharacter(mouse.Target.Parent) if mouse.Target.Parent:FindFirstChild("EnergyShield") and mouse.Target.Parent.EnergyShield.Stats.Humanoid.Health > 0 then mouse.Target.Parent.EnergyShield.Stats.Humanoid:TakeDamage(ShieldDamage) local swait = Instance.new("ObjectValue",mouse.Target.Parent) swait.Name = "ShieldWait" game.Debris:AddItem(swait,3) else if splr.TeamColor.Color ~= plr.TeamColor.Color then if mouse.Target.Name == "Head" then mouse.Target.Parent.Humanoid:TakeDamage(BaseDamage*1.25) else mouse.Target.Parent.Humanoid:TakeDamage(BaseDamage) end end end elseif mouse.Target.Parent:FindFirstChild("VehicleStats") then mouse.Target.Parent.VehicleStats.VehicleHealth.Value = mouse.Target.Parent.VehicleStats. VehicleHealth.Value - VehicleDamage end if mouse.Target.Name == "Light" then mouse.Target.BrickColor = BrickColor.new("Medium stone grey") local smashsound = game.Lighting.GameArchives.Sounds.GlassSmash:Clone() smashsound.Parent = mouse.Target smashsound:Play() game.Debris:AddItem(smashsound,1) if mouse.Target:FindFirstChild("PointLight") then mouse.Target.PointLight.Enabled = false elseif mouse.Target:FindFirstChild("SpotLight") then mouse.Target.SpotLight.Enabled = false end end wait(0.1) end
~Kierantech909 |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2013 05:38 AM |
Please could someone else help me? This user seems to be offline...
~Kierantech909 |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 22 Jul 2013 05:49 AM |
"local AnimHit,AnimPos = game.Workspace:FindPartOnRay(Ray.new(Weapon.Handle.CFrame*BarrelPos, (mouse.Hit.p - (Weapon.Handle.CFrame*BarrelPos)).unit*500),Tool)"
Is BarrelPos defined in an earlier part of the script?
~ The ATR Fishie ~ |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2013 05:53 AM |
| Yes, BarrelPos is meant to be the barrel's position when used in conjunction with the Tool's Handle position. |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2013 07:18 AM |
This is still a standing issue... help would be much appreciated.
~Kierantech909 |
|
|
| Report Abuse |
|
|
darthpyro
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 3569 |
|
|
| 22 Jul 2013 07:22 AM |
| Tool is already assigned (and has proper capitalization), I assume? |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2013 07:22 AM |
There are always free models when you need them Just sayin' |
|
|
| Report Abuse |
|
|
darthpyro
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 3569 |
|
|
| 22 Jul 2013 07:23 AM |
Leave. Now. Get out.
Get out of the one decent forum on ROBLOX. Seriously. Leave. Now. The door's that way.
|
|
|
| Report Abuse |
|
|
|
| 22 Jul 2013 07:29 AM |
Yes, every variable is accounted for.
~Kierantech909 |
|
|
| Report Abuse |
|
|
darthpyro
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 3569 |
|
|
| 22 Jul 2013 07:35 AM |
| And you've checked to make sure the capitalization of every variable is correct? That seems to be our most common issue. Poor capitalization. |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2013 07:37 AM |
I capitalized everything. It would've shown an error if not, right?
~Kierantech909 |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2013 07:38 AM |
Well... not EVERYTHING, per say, but you know what I mean.
~Kierantech909 |
|
|
| Report Abuse |
|
|
darthpyro
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 3569 |
|
|
| 22 Jul 2013 07:44 AM |
| It would really help if this had an output >..< |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2013 07:52 AM |
I know it stops between the Ray.new line and the line after, but aside from the prints, there's nothing.
~Kierantech909 |
|
|
| Report Abuse |
|
|
darthpyro
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 3569 |
|
|
| 22 Jul 2013 07:57 AM |
Something wrong with this, I suppose.
Weapon.Handle.CFrame*BarrelPos, (mouse.Hit.p - (Weapon.Handle.CFrame*BarrelPos)).unit*500
You're sure everything's pointing to the right path? mouse?
Try this, maybe?
local whateverthisdoesntmatter = Ray.new(Weapon.Handle.CFrame*BarrelPos, (mouse.Hit.p - (Weapon.Handle.CFrame*BarrelPos)).unit*500 |
|
|
| Report Abuse |
|
|
darthpyro
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 3569 |
|
|
| 22 Jul 2013 08:01 AM |
| woops forgot a bracket on the end of whateverthisdoesntmatter |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2013 08:09 AM |
Ok, I put that in, and it's stopping after the new Ray.new line. I put another print between it and the line that utilizes the ray, but that print didn't fire.
~Kierantech909 |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2013 12:06 PM |
Anyone else got any ideas? I'm starting to get desperate.
~Kierantech909 |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2013 12:12 PM |
| What type of variable is BarrelPos? Vector3 or CFrame? |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2013 12:45 PM |
BarrelPos is a Vector3.
~Kierantech909 |
|
|
| Report Abuse |
|
|