So I’m making a system where you click to “Push” things with your house, almost like you have a virtual hammer in your hand. to do this, I do not want to use any Body objects or tweening.
what I want to use is the Assemblylinearvelocity property.
This is my code so far:
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local dummypart = nil
local list = nil
local currentpart = nil
local function split(part)
part.Anchored = false
part.AssemblyLinearVelocity = mouse.Hit.Position.Unit * 20
end
mouse.Button1Down:Connect(function()
print("mouse down")
dummypart = Instance.new("Part", game.Workspace)
dummypart.Shape = "Ball"
dummypart.Size = Vector3.new(1.5,1.5,1.5)
dummypart.Position = mouse.Hit.Position
dummypart.Anchored = true
dummypart.Transparency = 1
list = dummypart:GetTouchingParts()
dummypart:Destroy()
for counter = 1, #list do
currentpart = list[counter]
if currentpart:GetAttribute("Destructeble") ~= nil then
split(currentpart)
end
end
end)
When I try this normally, the blocks only move left to right, not the impact direction.