I want to achieve an efficient system for merging things together as seen in this game: Game
I have tried countless times and unfortunately failed. Me and someone else were making this game and I am not skilled enough to make this system. I have been scripting for 5 years on Roblox, but this is a completely new thing to me.
Here is an example from the mobile game Merge Gems: External Media
You can write your topic however you want, but you need to answer these questions:
I keep the gems inside the 3-dimensional platform using math.clamp. It replicates on the server alright, and I’ve tried it with multiple machines, and it works successfully. But the problem is that .Touched events and TouchTransmitters, and it cannot work!
I’ve tried for countless hours, and unfortunately I do not have the code with me right now.
I am not asking you to write the code (you can if you want), I am asking you a better way to approach this.
I don’t know why .Touched or TouchTransmitters would help you in this situation, I think you could use Region3 and figure out if they are inside of one another and then merge them; simple and easy.
I am not an expert in using Region3 either but you can learn about it over on YouTube, Developer Forums or even hire a special programmer just for Region3 since it’s quite complicated at least from my point of view.
You can create a region3 with local region = Region3.new(minVector, maxVector). Note that all coordinates of the minVector must be less than the maxVector, or it will error.
Region3 doesn’t have an equivalent to Touched events, where a function can be fired when a part enters/leaves the region. Instead, your only choice will be to get find the parts inside of the region every so often. For a merge game, you can check only when a part is being dragged.
Pesudocode:
dragging.Changed:Connect(function()
while dragging.Value do
local partsInRegion = workspace:FindPartsInRegion3(region)
for _, part in pairs(partsInRegion) do
if part == partBeingDragged then
dragging.Value = false
-- merge the parts
end
end
game:GetService("RunService").Heartbeat:Wait()
end
end)