Hello so I am making a lava type game so I made a killing brick then i want to go up and destroy in a specific location but it wont work it would just go up!! So what do i do (Yes Yes I know i am dumb because I am a beginner scripter) Thank you for reading and helping me !!! Its ok if you dont know how I can fix this because There might be other people who can help!! Again thank you!!!
1 | local mover = script.Parent |
2 | wait( 5 ) |
3 | while true do |
4 | mover.Position = mover.Position + Vecter 3. new( 0 , 1 , 0 ) |
5 | if mover.Position = = ( 8 , 71.5 , 96 ) then |
6 | mover:Destroy() |
7 | end |
8 | end |
Your script has a few flaws here.
You spelt Vector3 wrong.
If you’re making a conditional statement that involves Position
remember to use Vector3.new(x, y, z)
instead of numbers since it represents a specific point 3D space
So it should look like this:
if mover.Position >= Vector3.new(8, 71.5, 96) then
That checks if the lava has passed or is in the position that’s specified
1 | local mover = script.Parent |
2 | wait( 5 ) |
3 | while true do |
4 | mover.Position = mover.Position + Vector 3. new( 0 , 1 , 0 ) |
5 | wait() |
6 | if mover.Position = = Vector 3. new( 8 , 71.5 , 96 ) then |
7 | mover:Destroy() |
8 | end |
9 | end |