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

Moving a part up and down without it being interruped?

Asked by 6 years ago

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)
0
you can use collision groups or use cframe instead of position theking48989987 2147 — 6y
0
try cframe OBenjOne 190 — 6y

3 answers

Log in to vote
0
Answered by 6 years ago

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
0
New problem. Is there a way that the part moves trough other parts? like goes inside a brick? but the player is still solid to it? Paintertable 171 — 6y
0
You could CollisionGroups for that. xPolarium 1388 — 6y
0
It should go inside a brick no problem since it is anchored EliteRayGawnX2 124 — 6y
Ad
Log in to vote
0
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
6 years ago

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
Log in to vote
-2
Answered by 6 years ago

Just Use F3X it will help you with anything, moving tools, stuff its way better.****

0
What does a building tool have to do with his scripting problem? xPolarium 1388 — 6y
0
true.. GlxkTerrence 5 — 6y

Answer this question