I am in a bit of a pickle here. I am trying to make a structure that crumbles when destroyed. Even though I have a script to un anchor all parts upon destruction, I think due to the mass of the parts, it usually remains stable.
I try to change its orientation vector3 slightly to lean it and have it tumble but it is usually not working.
I am hoping to give all parts a nudge upon destruction. Like a push from the side or center but I do not know how . . Hoping for your kind advice.
Thanks for replying. I am very poor at positions. I did read and read the ref but
How do I set directions? Like if I want it go front or back or side to the part. I am trying to make blood spatters for a gun script and I am also failing. I can only make the blood spawn and drop to the ground like a cube. But I can’t get it to spatter front or up etc.
Try looking at the default paintball gun that Roblox gives out. The paintball script works like this, maybe this will help with moving a part in a random direction:
ball = script.Parent
damage = 2
function onTouched(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
if hit:getMass() < 1.2 * 200 then
hit.BrickColor = ball.BrickColor
end
-- Edit: Specifically look here where it makes the Splat of the paint ball which you can replicate for your needs.
-- make a splat
for i=1,3 do
local s = Instance.new("Part")
s.Shape = 1 -- block
s.formFactor = 2 -- plate
s.Size = Vector3.new(1,.4,1)
s.BrickColor = ball.BrickColor
local v = Vector3.new(math.random(-1,1), math.random(0,1), math.random(-1,1))
s.Velocity = 15 * v
s.CFrame = CFrame.new(ball.Position + v, v)
ball.BrickCleanup:clone().Parent = s
s.BrickCleanup.Disabled = false
s.Parent = game.Workspace
end
if humanoid ~= nil then
tagHumanoid(humanoid)
humanoid:TakeDamage(damage)
wait(2)
untagHumanoid(humanoid)
end
connection:disconnect()
ball.Parent = nil
end
function tagHumanoid(humanoid)
-- todo: make tag expire
local tag = ball:findFirstChild("creator")
if tag ~= nil then
local new_tag = tag:clone()
new_tag.Parent = humanoid
end
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
connection = ball.Touched:connect(onTouched)
wait(8)
ball.Parent = nil