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: Vector3 HELP, WON'T WORK!!!

Previous Thread :: Next Thread 
Ttdp is not online. Ttdp
Joined: 03 Jul 2014
Total Posts: 155
21 Jul 2017 06:29 PM
My script works but the vector position won't work, I did a print value check and the X and Z numbers are always 0!!! Why is this?


Meteor_Size = Vector3.new(50,25,55)
Meteor_Shape = "Ball"

function MakeBaseMeteor()

local Meteor = Instance.new("Part",game.Workspace)
Meteor.Name = "Meteor"
Meteor.Size = Meteor_Size
Meteor.BrickColor = BrickColor.new("Dark Blue")
Meteor.Transparency = 0.5
Meteor.Anchored = false
Meteor.CanCollide = true
Meteor.Shape = Meteor_Shape

return Meteor

end

NGC = game.Workspace.NPC
NGC_Head = NGC.Head.Position



function OnClick()
local MeteorBase = MakeBaseMeteor()
local MeteorClone = MeteorBase
local Meteor_Blast = MeteorClone:clone()

local Random = math.random(1,4)

print (Random)

if Random == 1 then
Meteor_Blast.Position = (NGC_Head + Vector3.new(11,5,8))
print (MeteorClone.Position)
wait (2)
game.Debris:AddItem(MeteorClone,0.2)
end

if Random == 2 then
Meteor_Blast.Position = (NGC_Head + Vector3.new(9,5,11))
print (MeteorClone.Position)
wait (2)
game.Debris:AddItem(MeteorClone,0.2)
end

if Random == 3 then
Meteor_Blast.Position = (NGC_Head + Vector3.new(22,5,3))
print (MeteorClone.Position)
wait (2)
game.Debris:AddItem(MeteorClone,0.2)
end

if Random == 4 then
Meteor_Blast.Position = (NGC_Head + Vector3.new(10,8,6))
print (MeteorClone.Position)
wait (2)
game.Debris:AddItem(MeteorClone,0.2)
end

end

Brick = game.Workspace.Trigger

-- Click Event --

Brick.Touched:connect(OnClick)
Report Abuse
Ttdp is not online. Ttdp
Joined: 03 Jul 2014
Total Posts: 155
21 Jul 2017 06:34 PM
ok so no1 replies but other incoming late questions get replies...
Report Abuse
Helicopter_Crash is not online. Helicopter_Crash
Joined: 15 Apr 2017
Total Posts: 2022
21 Jul 2017 06:36 PM
try this format
vector3.new(1, 1, 1)
use the spaces

oof
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
21 Jul 2017 06:36 PM
You never set the position. Apparently the default position for it is 0.


Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
21 Jul 2017 06:37 PM
"try this format"
Doesn't make a difference, but I'm sure he appreciates the help c:


Report Abuse
Helicopter_Crash is not online. Helicopter_Crash
Joined: 15 Apr 2017
Total Posts: 2022
21 Jul 2017 06:38 PM
oh ok
i always used that so it though it might help


oof
Report Abuse
Ttdp is not online. Ttdp
Joined: 03 Jul 2014
Total Posts: 155
21 Jul 2017 06:39 PM
It's a function activated event. It's not supposed to have a pre-set position, it's almost the equivalent of a rocket launcher automatically being launched from the tool. It always spawns in the center of the head
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
21 Jul 2017 06:40 PM
I understand, but Meteor_Blast and MeteorClone are two separate things.

Meteor_Blast.Position = (NGC_Head + Vector3.new(11,5,8))
print (MeteorClone.Position)


Report Abuse
Ttdp is not online. Ttdp
Joined: 03 Jul 2014
Total Posts: 155
21 Jul 2017 06:43 PM
Aren't they the same value.. I only used MeteorClone because game:getservice only reads it as that
Report Abuse
Ttdp is not online. Ttdp
Joined: 03 Jul 2014
Total Posts: 155
21 Jul 2017 06:44 PM
o it works, ty :D
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Jul 2017 06:51 PM
To clarify:

local MeteorBase = MakeBaseMeteor()
local MeteorClone = MeteorBase
local Meteor_Blast = MeteorClone:clone()

MeteorClone and MeteorBase reference the same instance.

Meteor_Blast and MeteorClone (and by extension MeteorBase) are not the same instance, since Meteor_Blast is a copy.
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