So I am implementing a mining feature into my game but whenever the player mines an ore, it causes the game to freeze for a few frames.
local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local OreToClone = ReplicatedStorage.Objects.BreakableObjects.Ore.CoalOre
local OreSpawner = {}
OreSpawner.__index = OreSpawner
function OreSpawner.DeleteOre(ore: Instance)
local OreSpawn = ore.Parent
OreSpawn.Rotation = Vector3.new(0, math.random(0, 360), 0)
ore:Destroy()
local function SpawnOre()
wait(math.random(20,30))
local OreClone = OreToClone:Clone()
OreClone.Parent = OreSpawn
OreClone:PivotTo(OreSpawn.CFrame)
end
SpawnOre()
return
end
return OreSpawner
On the :Destroy() and Clone() all players have a sudden fps freeze
I have changed to different lighting (I am on voxel right now), made the script client-side, removed the code and just made it transparent which did the same fps drop, removed collisions, removed tags removed the respawning with the long :wait() and nothing seems to work.
I removed the listener also and just made the client destroy it on their side and it would still cause this issue
I just can’t seem to get past this after months of trying.