So right now my part moves up and down when i press the GUI for it but when i collide or touch with the moving part, it will move aside and bug out. I just want that it wont get interruped. is there a better way to move a part?
local GUI = script.Parent local Pic = GUI.Pic local text = Pic.Text GUI.Adornee = workspace.Pillar1 hack = false function HACK() if hack == false then local hackobj = game.workspace.Pillar1.HackObj for i = 1,17 do hackobj.Position = hackobj.Position + Vector3.new(0,-0.25,0) wait(0.03) end hack = true else local hackobj = game.workspace.Pillar1.HackObj for i = 1,17 do hackobj.Position = hackobj.Position + Vector3.new(0,0.25,0) wait(0.03) end hack = false end end Pic.MouseButton1Down:connect(HACK)
Since you are manipulating the parts position using vecto3 instead of bodyvelocity, this should work:
local GUI = script.Parent local Pic = GUI.Pic local text = Pic.Text GUI.Adornee = workspace.Pillar1 hack = false function HACK() if hack == false then local hackobj = game.workspace.Pillar1.HackObj hackobj.Anchored = true --here is the changed code for i = 1,17 do hackobj.Position = hackobj.Position + Vector3.new(0,-0.25,0) wait(0.03) end hack = true else local hackobj = game.workspace.Pillar1.HackObj hackobj.Anchored = true --here is the changed code for i = 1,17 do hackobj.Position = hackobj.Position + Vector3.new(0,0.25,0) wait(0.03) end hack = false end end
You need to use CFrame instead of Position.
local GUI = script.Parent local Pic = GUI.Pic local text = Pic.Text GUI.Adornee = workspace.Pillar1 hack = false function HACK() if hack == false then local hackobj = game.workspace.Pillar1.HackObj hackobj.Anchored = true for i = 1,17 do hackobj.CFrame = hackobj.CFrame * CFrame.new(0,-0.25,0) wait(0.03) end hack = true else local hackobj = game.workspace.Pillar1.HackObj hackobj.Anchored = true for i = 1,17 do hackobj.CFrame = hackobj.CFrame * CFrame.new(0,0.25,0) wait(0.03) end hack = false end end
Just Use F3X it will help you with anything, moving tools, stuff its way better.****