Touched event, extreme lag

If you need more prints just say

At what point does the lag start in all that? All the prints are laid out more or less exactly as expected.

After reading through some of your code, I’ve noticed that you’re enabling an Animation script. This could be what is causing your lag, can you send the contents of Efeito2clonado.AnimationScript?

1 Like

its just a while with TweenService

Again, please send the contents of the script. I’d just like to be sure.

local tweenService = game:GetService("TweenService")

local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0.5, false, 0)

local goal = {Size = Vector3.new(80,80,80)}
local tween = tweenService:Create(script.Parent	, tweenInfo, goal)

while true do
	tween:Play()
	wait(0.5)
	script.Parent.Size = Vector3.new(60,60,60)
end

Can you be more direct? i dont understand

Hello my friend. you found any solution? or you just leave

what is the Chao? is that a players name or something else?

if QuemTocou.Name == "Chao" then

Chao = floor, its just the baseplat

ok i believe i know what’s happening the ball gets touched by the player it consistently is running but you only want it to run when it hits the baseplate? am i right?

i think yes, run one time after touch the BasePlat

How I do this(Like last year) I use TweenService, Raycast and Magnitude, I make all effects in the client via remote events, and I let the damage and checks in the server like for a AOE damage, I use magnitude to check who’s within range, apply a debounce using tick() or os.clock(), and for client just tween and send the projectile towards my mouse position(You need to send mouse position to server to raycast)

sorry about my grammar, english is not my native languange

you have discord for talk to me tomorrow? i’m really losing my hopes

try this i removed the last debounce and it only runs once and that’s when it hits the baseplate.
let me know if it doesn’t work.

this really just sets the debounce to true once chao is actually hit and once its set to true it can not be runned again.

local function touched(QuemTocou)
		if Debounce then return end
		if QuemTocou.Name == "Chao" then
			Debounce = true
			touchedConn:Disconnect()
			wait(1)
			LightBombClone.Anchored = true
			Efeito1Clonado.Parent = workspace
			Efeito1Clonado.Position = LightBombClone.Position + Vector3.new(0,-20,0)
			Efeito2Clonado.AnimationScript.Disabled = false
			char.CameraShake.Disabled = false
			wait(7)
			for y = 0,1,0.1 do
				wait(0.1)
				LightBombClone.Transparency = y
			end
			char.CameraShake.Disabled = true
			LightBombClone:Destroy()
			Efeito1Clonado:Destroy()
			Efeito2Clonado:Destroy()
		end
	end

You forgot to set debounce to false at the bottom?

image

it only runs once it doesn’t need to reset the debounce

did you see the image how to fix it?

its touchedConn is not set to any value but it should still work without stopping script.