How would I change a Value for each player locally, but not on the server

I’m trying to make a bullet effect, it has a red dot that changes size based on the local player’s distance to the bullet.
But I don’t really know how to do this.
Here’s my script

local Dot = script.Parent.Dot
local Emitter = script.Parent.Dots.ParticleEmitter

function CheckPlayerDistance()
	local Player = game.Players.LocalPlayer
	local Char = Player.Character
	Dot.Value = (Char.Position - script.Parent.Position).Magnitude

while true do
	Emitter.Size ={,0),,Dot.Value)

This doesn’t seem to do anything, it doesn’t even print(“Test”), this is a local script in a part.

How would I achieve this?

Local scripts don’t run in the workspace, with the exception of local scripts that are the descendants of a player’s character. I would probably use CollectionService and parent the local script to StarterPlayerScripts. Also,

  • Don’t reference services using ., use GetService, as it works even if the service is accidentally renamed.
  • You should use task.wait as it doesn’t throttle like wait
1 Like

So would I use the collection service, to check if there are any parts tagged with Say: “Bullet”. If so then it sends a remote event to all players, and the local script in the players will change the dot value and size locally?

You could do that, but I would just have a local script that uses collection service, checks for the tag parts, and changes the dot value and size.

1 Like

So I would use collectionService in the local script?, Sorry I’ve never used collectionService before. How would i tag an object?


I would use a plugin. If you need to tag a part during the game, you can use CollectionService:AddTag()

1 Like

Since I need to add a tag in-game, How would I do that server-side? or locally

If the bullet is created on the server, you would tag it on the server. If it is created on the client, tag it on the client.

1 Like

Okay Thanks for the info, It’s server-sided btw. Idk if that’s good for the server or not but ima go with it.

I’ll Test out some script, and mark you as the solution if everything works out!

Pfft real MVPS do

game.GetService(game, "CollectionService")