Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Lots of lag in my script?

Hello guys and i have a simple brick that fades away when touched, and fades back. The fade part works fine, but there is a 2-3 second delay until it changes the canCollide


script.Parent.Touched:connect(function(hit)
	if hit.Parent and hit.Parent.Humanoid then
		
	for i=10, 0, -1 do
		script.Parent.Transparency = script.Parent.Transparency + 0.1
		if script.Parent.Transparency == 0.9 then script.Parent.CanCollide = false break end
		wait(0.1)
	end
	
	wait(2)
	
	for i=10, 0, -1 do
		script.Parent.Transparency = script.Parent.Transparency - 0.1
		if script.Parent.Transparency == 0.1 then script.Parent.CanCollide = true break end
		wait(0.1)
	end

	end
end)

Any help is appreciated.

1 answer

Is the script lagging in actual play mode (not in studio)? Sometimes that's the problem. I have a game that I have 5 different files for testing to keep the lag down, and a testing place for...well...testing, and it always runs perfectly fine in testing

1 comment

0

i figured it out. thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.