-
What do you want to achieve?
I want to make the movement handles move on the right direction -
What is the issue?
I made a part movement system using movement handles, however, the handle moves the part in the wrong direction. It seems like it only works right for parts with the 0,0,0 orientation. Also for each orientation the handle changes its direction
Here’s the script:
(it’s a local script placed into a ScreenGui in the StarterGui, inside there’s also a ObjectValue named “Part” which I used for testing. Also the parts need to have a BoolValue inside called “CanMove” for them to work with the system)
local plr = game.Players.LocalPlayer
local m = plr:GetMouse()
m.Button1Down:Connect(function()
if m.Target:FindFirstChild("CanMove") then ----- can only use parts with a boolvalue inside called "CanMove"
script.Parent.Part.Value = m.Target
if script.Parent:FindFirstChild("handle") then
script.Parent.handle:Destroy()
end
local handle = Instance.new("Handles")
handle.Parent = script.Parent
handle.Style = "Movement"
handle.Name = "handle"
handle.Adornee = m.Target
local lastCFrame = nil
script.Parent.handle.MouseDrag:Connect(function(face,distance)
local Direction = Vector3.FromNormalId(face)
script.Parent.Part.Value.CFrame = lastCFrame + (Direction * distance)
end)
script.Parent.handle.MouseButton1Down:Connect(function()
lastCFrame = script.Parent.Part.Value.CFrame
end)
end
end)