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 » Scripters
Home Search
 

Re: i need help with one thing with magnitude

Previous Thread :: Next Thread 
JoshOctober16 is not online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
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
JoshOctober16 is not online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
31 Oct 2015 06:47 PM
bump
Report Abuse
EchoReaper is not online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
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 is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
31 Oct 2015 06:51 PM
may as well use a vector2
Report Abuse
JoshOctober16 is not online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
31 Oct 2015 07:38 PM
but isn't vector2 only x and y and not z cuz I need z
Report Abuse
SwagCuzYolo is not online. SwagCuzYolo
Joined: 31 Oct 2013
Total Posts: 1224
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
JoshOctober16 is not online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
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 is not online. 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
SwagCuzYolo is not online. SwagCuzYolo
Joined: 31 Oct 2013
Total Posts: 1224
31 Oct 2015 07:59 PM
The sphere by definition is equal sizes so it can be a sphere.
Report Abuse
JoshOctober16 is not online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
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
SwagCuzYolo is not online. SwagCuzYolo
Joined: 31 Oct 2013
Total Posts: 1224
31 Oct 2015 08:11 PM
Magnitude
Report Abuse
JoshOctober16 is not online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
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 is not online. 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
JoshOctober16 is not online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
31 Oct 2015 08:29 PM
that's the problem I tryd last time and it gives me a error
Report Abuse
SwagCuzYolo is not online. SwagCuzYolo
Joined: 31 Oct 2013
Total Posts: 1224
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
JoshOctober16 is not online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
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
JoshOctober16 is not online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
31 Oct 2015 08:51 PM
nvm about that error it was cause x and z wasn't in caps
Report Abuse
JoshOctober16 is not online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
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
JoshOctober16 is not online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
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
JoshOctober16 is not online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
31 Oct 2015 09:04 PM
if I can make this script work then it should be ready to go
Report Abuse
JoshOctober16 is not online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
31 Oct 2015 11:37 PM
bump
Report Abuse
JoshOctober16 is not online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
01 Nov 2015 12:47 AM
bump 1
Report Abuse
JoshOctober16 is not online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
01 Nov 2015 02:06 AM
bump 2
Report Abuse
JoshOctober16 is not online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
01 Nov 2015 02:46 PM
bump 3
Report Abuse
Dogejia is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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