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

Need help creating a non lag script to make parts far away from the player transparent?

Asked by 6 years ago
Edited 6 years ago

i want to make it so that the player goes through a grass field without much lag, But it doesn't work, as it cannot understand global 'avatar' at line 10, a nil value. What do?

distance = 200

avatar = game.Players:FindFirstChildOfClass("Player")
grass = workspace.GrassField:GetChildren()

for g=1, #grass do
    grasspatch = grass[g]
end

if (avatar.character.Torso.Position - grass.Position).magnitude <= distance then
    grasspatch.transparency = 0
else
    grasspatch.transparency = 1
end
0
I'm pretty sure just changing the transparency of a brick won't help with lag... T0XN 276 — 6y
0
Yeah, changing the transparency does not because the physics engine still has to process it. Maybe delete the grass instead. hiimgoodpack 2009 — 6y

Answer this question