What do you want to achieve? I want to make a game where you must survive a nuke in the default “Suburban” Roblox place.
What is the issue? When the nuke is growing, it lags the game to the point where it is unplayable.
Video not loading, I can’t show
What solutions have you tried so far? I’ve tried using multiple different constraints such as the hinge and weld, but those lag the game, and weld doesn’t work properly with another script. I cannot have the nuke anchored as it uses a .Touched() event to work. I’ve also tried using BodyVelocity and BodyPosition, but those don’t work and they are deprecated.
Here’s my grow script.
local waittime = .001
while true do
script.Parent.Size = script.Parent.Size + Vector3.new(1,1,1)
wait(waittime)
waittime = waittime + .0001
if waittime >= .1 then
script.Parent:Destroy()
end
end
the real issue here is the inherent cost of growing a part for whatever reason this operation is always laggy regardless of tween it must have something to do with how the engine calculates physics and the math/data im unsure tbh with you
to solve this issue I actually started using a file mesh inside a part and growing the file meshes scale you can also use a special mesh and select the shape you desire as a neat workaround this caused no lag for my server but to be double cautious I also made the client do it as added bonus that’s a separate can of worms but using tween to grow a part to large sizes is a guaranteed way to watch the server ping tank im unsure why but have experienced this problem for years
for dmg if your adding a .touched on top of a large growing part oh my goodness the lag from all the checks every time it touches something causes immense lag at large scales its better to grow a mesh scale not a meshpart sadly it suffers the same issues then use a magnitude check against all players to see if they are in the blast range this is easy enough example
if (player.Character.HumanoidRootPart.Position - nuke.Position).Magnitude < CurrentBlastradius then
player.Character.Humanoid.Health = 0
end