–Server Script
local VoxBreaker = require(game.ReplicatedStorage.VoxBreaker)
local remote = game.ReplicatedStorage.RemoteEvent
remote.OnServerEvent:Connect(function(player,cframe)
local voxels = VoxBreaker:CreateHitbox(Vector3.new(5, 6, 6),cframe,Enum.PartType.Ball,1,20)
for _,voxel in voxels do
voxel.Parent = game.ReplicatedStorage --Parent voxels to replicated storage so that the client can see them
end
remote:FireAllClients(voxels,cframe) --Fire the table back to the client before destroying them on the server
for _,voxel in voxels do
voxel:Destroy()
end
end)
for _, part in workspace.Map[“Biome Sprites”]:GetDescendants() do
if (part:IsA(“BasePart”) or part:IsA(“MeshPart”) or part:IsA(“UnionOperation”)) and (part.Name ~= “Snowflakes”) then
part:SetAttribute(“Destroyable”, true)
end
end
for _, part in workspace.Map.Biomes:GetDescendants() do
if (part:IsA(“BasePart”) or part:IsA(“MeshPart”) or part:IsA(“UnionOperation”)) and (part.Name ~= “Snowflakes”) then
part:SetAttribute(“Destroyable”, true)
end
end
–Local Script
local crumbleSound = script:WaitForChild(“crumble”)
local VoxBreaker = require(game.ReplicatedStorage.VoxBreaker)
local Random = Random.new()
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(voxels,cframe)
local sound = crumbleSound:Clone()
sound.Parent = voxels[1]
sound.PlaybackSpeed = Random:NextInteger(0.85,1.15)
sound.Volume = sound.Volume
sound:Play()
game.Debris:AddItem(sound, 3)
for _,voxel in voxels do
local clone = voxel:Clone()
clone.Parent = workspace.Destruction
clone.Anchored = false
local velocity = CFrame.lookAt(clone.Position,cframe.Position).LookVector * (-85 * (clone.Mass))
clone:ApplyImpulse(velocity)
clone.Velocity = velocity / 8
clone:ApplyAngularImpulse(velocity)
clone:SetAttribute(“Destroyable”, true)
end
task.wait(30)
for _,v in workspace.Destruction:GetChildren() do
v:Destroy()
end
end)
Sorry I’m new to the devforum and don’t know how to format