|
| 31 Oct 2015 05:24 PM |
I need a magnitude that only looks for x and z not x y z or x y, the reason I need to make a tornado damage script but the problem the damage is a sphere the thing I want change is I need the y part to be larger
the main reason I need this is cuz whena tornado hits a tall building the top dosnt get damage |
|
|
| Report Abuse |
|
|
| |
|
|
| 31 Oct 2015 06:48 PM |
v1,v2
print(Vector3.new(v1.X,0,v1.Z)-Vector3.new(v2.X,0,v2.Z)).magnitude |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
| |
|
|
| 31 Oct 2015 07:38 PM |
| but isn't vector2 only x and y and not z cuz I need z |
|
|
| Report Abuse |
|
|
|
| 31 Oct 2015 07:40 PM |
I don't know exactly what you mean, but you can isolate vectors like this.
XY = workspace.Part.Position * Vector3.new(1,0,1) |
|
|
| Report Abuse |
|
|
|
| 31 Oct 2015 07:54 PM |
| what I mean is imagen if theres a invisible sphere that when you go in it it finds you , what I want is to change this sphere size for only the Y size to be larger then the X and Z |
|
|
| Report Abuse |
|
|
Zecrit
|
  |
| Joined: 24 Jan 2013 |
| Total Posts: 2618 |
|
|
| 31 Oct 2015 07:57 PM |
| Use raycast to calculate the distance (Magnitude) between all player character torso's in workspace and the brick itself. |
|
|
| Report Abuse |
|
|
|
| 31 Oct 2015 07:59 PM |
| The sphere by definition is equal sizes so it can be a sphere. |
|
|
| Report Abuse |
|
|
|
| 31 Oct 2015 08:08 PM |
| ok what I mean is for exsample a black hole that if your too close to it it pulls you in script , what I want different is if your under or ontop of it it will pull you in even if your far away |
|
|
| Report Abuse |
|
|
| |
|
|
| 31 Oct 2015 08:17 PM |
| I said I need the magnitude to not count the y in position, I have never heard or seen how to do it that's why im in here talking about it |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 31 Oct 2015 08:24 PM |
Echoreaper's will work, you haven't bothered to try it.
Also (Vector2.new(V1.X, V2.Z) - Vector2.new(V2.X, V2.Y)).magnitude will work also |
|
|
| Report Abuse |
|
|
|
| 31 Oct 2015 08:29 PM |
| that's the problem I tryd last time and it gives me a error |
|
|
| Report Abuse |
|
|
|
| 31 Oct 2015 08:41 PM |
X = part.Position.X - part2.Position.X Z = part.Position.Z - part2.Position.Z
if math.abs(x) < 10 and math.abs(z) < 10 then -- they are close end |
|
|
| Report Abuse |
|
|
|
| 31 Oct 2015 08:49 PM |
it gives me this error
22:48:53.058 - Workspace.Script:4: bad argument #1 to 'abs' (number expected, got nil) |
|
|
| Report Abuse |
|
|
|
| 31 Oct 2015 08:51 PM |
| nvm about that error it was cause x and z wasn't in caps |
|
|
| Report Abuse |
|
|
|
| 31 Oct 2015 09:02 PM |
ok I don't get it what am I doing wrong now it gives me this error script ef0end 23:00:21.936 - Workspace.power.Car1.Valuee0High.Scriptsf0en:45: attempt to index local 'relPosX' (a number value) 23:00:21.937 - Stack Begin 23:00:21.939 - Script 'Workspace.power.Car1.Valuee0High.Scriptsf0en', Line 45 23:00:21.940 - Stack End |
|
|
| Report Abuse |
|
|
|
| 31 Oct 2015 09:03 PM |
and here is the script that has the error that im trying to fix
local Vortex = script.Parent.Parent local childList = {}
local massConstant = 5.8
function checkObject(obj) if (obj ~= Vortex) and (obj.Name == "f0c") then if (obj.Anchored == false) then table.insert(childList, 1, obj) end elseif (obj.className == "Model") or (obj == workspace) then local child = obj:GetChildren() for x = 1, #child do checkObject(child[x]) end obj.ChildAdded:connect(checkObject) end end
checkObject(workspace)
print("script ef0end")
local n = 0 while true do local mass = script.Parent.Value * massConstant if n < #childList then n = n + 1 if n % 800 == 0 then wait(0.5) end else n = 1 wait(0.5) end
local child = childList[n] if (child ~= Vortex) and (child.className == "Part") or (child.className == "TrussPart") or (child.className == "WedgePart") or (child.className == "Seat") or (child.className == "VehicleSeat") and (child.Anchored == false) then local relPos = Vortex.Position - child.Position local relPosX = Vortex.Position.X - child.Position.X local relPosZ = Vortex.Position.Z - child.Position.Z local motivator = child:FindFirstChild("Ht0end") if relPosX.magnitude * 20 * massConstant <= mass and relPosZ.magnitude * 20 * massConstant <= mass then child:BreakJoints() if (relPos.magnitude * 3000 * massConstant <= mass) and (child.Size.z + Vortex.Size.x > relPos.magnitude * 2 - 4) then table.remove(childList, n) n = n - 1 motivator:Remove() else if motivator == nil then motivator = Instance.new("BodyPosition") motivator.Parent = child motivator.Name = "Ht0end" end motivator.position = Vortex.Position local m = math.random(1,5) if m == 1 then motivator.maxForce = Vector3.new(-13.7, -13.7, -13.7) * mass * child:GetMass() / (relPos.magnitude * massConstant) end if m == 2 then motivator.maxForce = Vector3.new(13.7, 13.7, 13.7) * mass * child:GetMass() / (relPos.magnitude * massConstant) end if m == 3 then motivator.maxForce = Vector3.new(13.7, -13.7, 13.7) * mass * child:GetMass() / (relPos.magnitude * massConstant) end if m == 4 then motivator.maxForce = Vector3.new(13.7, -13.7, 13.7) * mass * child:GetMass() / (relPos.magnitude * massConstant) wait(0.2) table.remove(childList, n) n = n - 1 child.Name = "f1low" motivator:Remove() end if m == 5 then motivator.maxForce = Vector3.new(13.7, -13.7, 13.7) * mass * child:GetMass() / (relPos.magnitude * massConstant) wait(0.2) table.remove(childList, n) n = n - 1 child.Name = "f1low" motivator:Remove() end end elseif motivator ~= nil then motivator:Remove() end end end |
|
|
| Report Abuse |
|
|
|
| 31 Oct 2015 09:04 PM |
| if I can make this script work then it should be ready to go |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
Dogejia
|
  |
| Joined: 08 Feb 2012 |
| Total Posts: 1873 |
|
|
| 01 Nov 2015 02:49 PM |
Literally;
(plr.Character.Torso.CFrame.x-script.Parent.CFrame.x).magnitude
Online Dogeing since 1337 |
|
|
| Report Abuse |
|
|