Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i destroy a brick at a specific location ???

Asked by 6 years ago

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!!!

local mover = script.Parent
wait(5)
while true do 
    mover.Position = mover.Position + Vecter3.new(0,1,0)
    if mover.Position == (8, 71.5, 96) then
        mover:Destroy()
    end
end

2 answers

Log in to vote
0
Answered by
Rhythic 36
6 years ago
Edited 6 years ago

Your script has a few flaws here.

  1. You spelt Vector3 wrong.

  2. 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

0
Still going up DarkModule 34 — 6y
0
it would be a error: 04:10:45.162 - Workspace.Part.Script:6: attempt to compare two userdata values 04:10:45.162 - Stack Begin 04:10:45.165 - Script 'Workspace.Part.Script', Line 6 04:10:45.166 - Stack End WindowMall 54 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
local mover = script.Parent
wait(5)
while true do 
    mover.Position = mover.Position + Vector3.new(0,1,0)
wait()
    if mover.Position == Vector3.new(8, 71.5, 96) then
        mover:Destroy()
    end
end

Answer this question