the video isn’t giving me much information due to the extreme lag, so could you maybe try making a better quality video for me to understand the problem better
for i=1,2,1 do -- this is creating two blocks
local selectednum = 2
task.spawn(putBlocks, selectednum)
end
task.spawn(function()
local debounce = false
while event.Event:Wait() do -- never seen anything like this done before
if not debounce then
debounce = true
local selectednum = numbers[math.random(1,#numbers)]
task.spawn(putBlocks, selectednum)
wait(1.5)
debounce = false
end
end
end)
task.spawn(function() -- this is adding a new block every 25 seconds
while wait(25) do
local selectednum = numbers[math.random(1,#numbers)]
task.spawn(putBlocks, selectednum)
end
end)
its the fuse handler script, located in the server script service*, not spawner.
local block = game:GetService("ServerStorage"):FindFirstChild("Block")
local folder = workspace:WaitForChild("Blocks")
local event = game:GetService("ReplicatedStorage").FuseBlocks
local TS = game:GetService("TweenService")
local TweenInf = TweenInfo.new(
1.5, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut
)
function animate2parts(partA:BasePart, partB:BasePart, combinedPart:BasePart)
partA.CanTouch = false
partB.CanTouch = false
partA.Anchored = true
partB.Anchored = true
local TweenA = TS:Create(partA, TweenInf,
{
Position = combinedPart.Position,
Rotation = combinedPart.Rotation,
Size = combinedPart.Size,
}
)
local TweenB = TS:Create(partB, TweenInf,
{
Position = combinedPart.Position,
Rotation = combinedPart.Rotation,
Size = combinedPart.Size,
}
)
TweenA:Play()
TweenB:Play()
wait(TweenInf.Time)
combinedPart.Parent = folder
partA:Destroy()
partB:Destroy()
end
event.Event:Connect(function(partA:BasePart, partB:BasePart)
if partA:FindFirstChild("num") and partB:FindFirstChild("num") then
local numA = partA:FindFirstChild("num").Value
local numB = partB:FindFirstChild("num").Value
local sum = numA + numB
if numA == numB then
local part1Pos = partA.CFrame
local part2Pos = partB.CFrame
local velrot, vel = Vector3.new()
local newPos = part1Pos:Lerp(part2Pos, .5)
local newBlock = block:Clone()
newBlock.num.Value = sum
newBlock.CFrame = newPos
newBlock.Size = Vector3.new(
4+math.round(math.max(0,sum/64)),
4+math.round(math.max(0,sum/64)),
4+math.round(math.max(0,sum/64))
)
newBlock.Position += Vector3.new(0,(newBlock.Size.Y)/2, 0)
if (partA.AssemblyLinearVelocity.Magnitude >= partB.AssemblyLinearVelocity.Magnitude) then
vel = partA.AssemblyLinearVelocity
else
vel = partB.AssemblyLinearVelocity
end
if (partA.AssemblyAngularVelocity.Magnitude >= partB.AssemblyAngularVelocity.Magnitude) then
velrot = partB.AssemblyAngularVelocity
else
velrot = partB.AssemblyAngularVelocity
end
vel = Vector3.new(vel.X, math.min(0, vel.Y), vel.Z)
newBlock.AssemblyLinearVelocity = vel
newBlock.AssemblyAngularVelocity = velrot
spawn(function()
animate2parts(partA, partB, newBlock)
end)
end
end
end)