How would I replicate the visual part of a server script to only certain players?

What do I mean by replicate the visuals?
So I’m developing a multi-level 2D platformer with a cartoon based design. In the background of the first level, I have moving bushes and trees that sway in a certain pattern. I would like to make it so only certain players see the bushes and trees move.

Why do I need to replicate the visuals to only certain users?
I’m making my game console-compatible, and when I tested my game out on my Xbox One I found it’s very hard to run due to the number of moving parts present on the screen. The game runs brilliantly on PC though despite the lag on the console version.

The server script inside each of the moving parts:

pos = script.Parent.Position
pos =, pos.y-0.2, pos.z)
x = 0
z = 0
T = -99999
tall = script.Parent.Size.Y / 2
rand = (math.random(0,20))/10
while true do
x = pos.x + (math.sin(T + (pos.x/5)) * math.sin(T/9))/3
z = pos.z + (math.sin(T + (pos.z/6)) * math.sin(T/12))/4
script.Parent.CFrame =, pos.y, z) * CFrame.Angles((z-pos.z)/tall, 0,(x-pos.x)/-tall)
	T = T + 0.12

The main concern?
I really don’t want to remove the tree and bush movement as it adds tiny detail I feel some players would appreciate it. It also contributes to a more lively dynamic environment instead of a bland static environment.

How would I go about making the CFrame movement in a part only work locally in a local script? So that the script only executes for certain players.

Thank You :]

1 Like

If you just want to optionally disable this specific use case (trees moving), make a LocalScript with a table with references of all moving trees and make it iterate through all trees, moving them. To disable it then the client just has to set the script’s Disabled to true.