Help with a problem

I am trying to create a tornado similar to the ones in Twisted. However, I have come across an issue that causes the parts to make gaps when the game lags. All I was told was to figure out a way to factor in lag. I don’t exactly know how I would do that, and it’d be awesome if any of you could help. Here is a video showing exactly the problem. Thanks!


And just in case, here is a clip of what I am trying to achieve:

while wait(0.0001) do
	torpart = game.ServerStorage.Torpart:Clone()
	winds = script.Parent.Winds
	SizeMultiplier = script.Parent.SizeMultiplier.Value
	origin = script.Parent.TornadoParts.Origin
	Strength = script.Parent.Strength.Value
	TweenService = game:GetService("TweenService")
	torpart.Mesh.Scale = Vector3.new(winds.Value * SizeMultiplier / 2 * Strength, winds.Value * SizeMultiplier / 2 * Strength, winds.Value * SizeMultiplier / 2 * Strength)
	torpart.Parent = script.Parent.TornadoParts
	torpart.Position = origin.Position + Vector3.new(origin.Mesh.Offset.X, 0, origin.Mesh.Offset.Z)
	script.Parent.SizeAmount.Value = winds.Value * SizeMultiplier / 7 * Strength
	script.Parent.Windfield.Value = winds.Value * SizeMultiplier / 2 * Strength
	TweenService:Create(torpart, TweenInfo.new(20, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false), {Position = Vector3.new(torpart.Position.X, 8200, torpart.Position.Z)}):Play()
	TweenService:Create(torpart.Mesh, TweenInfo.new(20, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false), {Scale = Vector3.new(winds.Value * SizeMultiplier * 1.3 * Strength, winds.Value * SizeMultiplier * 1.3 * Strength, winds.Value * SizeMultiplier * 1.3 * Strength)}):Play()
	changetype = math.random(1,60)
end

2 Likes

Try using task.wait() instead of wait()
I would avoid using wait() for stuff like this since it’s laggy

while task.wait(0.0001) do
	torpart = game.ServerStorage.Torpart:Clone()
	winds = script.Parent.Winds
	SizeMultiplier = script.Parent.SizeMultiplier.Value
	origin = script.Parent.TornadoParts.Origin
	Strength = script.Parent.Strength.Value
	TweenService = game:GetService("TweenService")
	torpart.Mesh.Scale = Vector3.new(winds.Value * SizeMultiplier / 2 * Strength, winds.Value * SizeMultiplier / 2 * Strength, winds.Value * SizeMultiplier / 2 * Strength)
	torpart.Parent = script.Parent.TornadoParts
	torpart.Position = origin.Position + Vector3.new(origin.Mesh.Offset.X, 0, origin.Mesh.Offset.Z)
	script.Parent.SizeAmount.Value = winds.Value * SizeMultiplier / 7 * Strength
	script.Parent.Windfield.Value = winds.Value * SizeMultiplier / 2 * Strength
	TweenService:Create(torpart, TweenInfo.new(20, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false), {Position = Vector3.new(torpart.Position.X, 8200, torpart.Position.Z)}):Play()
	TweenService:Create(torpart.Mesh, TweenInfo.new(20, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false), {Scale = Vector3.new(winds.Value * SizeMultiplier * 1.3 * Strength, winds.Value * SizeMultiplier * 1.3 * Strength, winds.Value * SizeMultiplier * 1.3 * Strength)}):Play()
	changetype = math.random(1,60)
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.