Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Lots of lag in my script?

Asked by 10 years ago

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

01script.Parent.Touched:connect(function(hit)
02    if hit.Parent and hit.Parent.Humanoid then
03 
04    for i=10, 0, -1 do
05        script.Parent.Transparency = script.Parent.Transparency + 0.1
06        if script.Parent.Transparency == 0.9 then script.Parent.CanCollide = false break end
07        wait(0.1)
08    end
09 
10    wait(2)
11 
12    for i=10, 0, -1 do
13        script.Parent.Transparency = script.Parent.Transparency - 0.1
14        if script.Parent.Transparency == 0.1 then script.Parent.CanCollide = true break end
15        wait(0.1)
16    end
17 
18    end
19end)

Any help is appreciated.

1 answer

Log in to vote
2
Answered by 10 years ago

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

0
i figured it out. thanks freerobux456 0 — 10y
Ad

Answer this question