Instead of using a truss and clipping it inside the part. Each part get's divided into segments with the gap of 1 stud. Then I need to create a clone of the part but make it's Scale.Y small and it's Scale.X and Scale.Z to be slightly larger to make it climbable. The problem is I only have the analogy to how it could be done but got no clue on how to actually script it. It's only my 5th day in Roblox Studio so I'm still a beginner.
I tried to do this and ended up with this script but this just froze and crashed the Studio..
local boxes = script.Parent:GetChildren()
for _, box in ipairs(boxes) do
if box:IsA("Model") then
local parts = box:GetChildren()
for _, stone in ipairs(parts) do
if stone:IsA("Part") and stone.Material == Enum.Material.Rock then
task.wait(0.1)
local distanceY = math.floor(stone.Size.Y)
local segments = distanceY / 2
for i = 1, segments do
local topPosition = distanceY - (distanceY / 2)
local slab = stone:Clone()
slab.Size = Vector3.new(stone.Size.X, 1, stone.Size.Z)
slab.Position = Vector3.new(stone.Position.X, topPosition - i * segments , stone.Position.Z)
slab.Anchored = true
slab.Parent = stone
end
end
end
end
end