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

How to split a part into peices?

Asked by 4 years ago

I've been trying to do this for a while Basically it would convert the avatar from r6 to r12 and r15 to r30. The reason for this is realistic fire effect. I've looked at many code samples but I haven't figured it out. Heres my code

local function destroy(prt)
local prts = {}
for i=1,(prt.Size.Y)/0.5 do
    for i2=1,(prt.Size.X)/0.5 do
        for i3=1,(prt.Size.Z)/0.5 do
        local part = prt:Clone()
        if part:FindFirstChild("Sign") then
            part.Sign:Destroy()
        end
        if part:FindFirstChild("Needle") then
            part.Needle:Destroy()
        end
        part.Parent = game.Workspace
        part.Position = Vector3.new(((prt.Position.X - prt.Size.X/2)*(i2*0.5)),((prt.Position.Y - prt.Size.Y/2)*(i*0.5)),((prt.Position.Z - prt.Size.Z/2)*(i3*0.5)))
        --part.Parent = prt.Parent
        part.Size = Vector3.new(0.5,0.5,0.5)
        part.CanCollide = true
        part.Anchored = true
        table.insert(prts,part)
        end
    end
end
for i,v in pairs(prts) do
    v:BreakJoints()
    if i ~= 1 then
    --[[local weld = Instance.new("WeldConstraint")
    weld.Part0 = v
    weld.Part1 = prts[i-1]
    weld.Parent = v--]]
    end
    v.Anchored = true
end
prt:Destroy()
end 
wait(5)
char = game.Players.LocalPlayer.Character
for i,v in pairs(char:GetChildren()) do
    wait(5)
    if v:IsA("BasePart") and v.Name ~= "Head" and v.Name ~= "Torso" and v.Name ~= "HumanoidRootPart" then
        destroy(v)
    end
end

thanks in advance

2 answers

Log in to vote
0
Answered by 4 years ago

umm... it will be in multiple Part s but anyways:

--Lets say for example that there are 4 parts
local P1 = Instance.new("Part", workspace)
local P2 = Instance.new("Part", workspace)
local P3 = Instance.new("Part", workspace)
local P4 = Instance.new("Part", workspace)

P1.Position = Vector3.new(NumX,NumY,NumZ)
P2.Position = Vector3.new(NumX,NumY,NumZ)
P3.Position = Vector3.new(NumX,NumY,NumZ)
P4.Position = Vector3.new(NumX,NumY,NumZ)
0
did you read the question? XXleo29maxXX 0 — 4y
0
You need to reword your question. AizakkuZ 226 — 4y
Ad
Log in to vote
0
Answered by
AizakkuZ 226 Moderation Voter
4 years ago

What you're trying to do though is basically impossible. The best way to split a part is https://developer.roblox.com/en-us/api-reference/function/BasePart/SubtractAsync but, your question seems to want to split a mesh. Not to mention your question makes literally no sense in itself, as you said your reason was, "The reason for this is realistic fire effect."

Answer this question