This is the 4 time I have posted, here is my question:
Let’s say I have a part called PartA, if the distance between a player and the PartA is < 100 studs, then it will display an image on the client side. Therefore, I should add a tag for PartA and use CollectionService to check each Part with a tag and check the player distance between parts for each part every second or there is a better method?
Also, when the image is displayed, how to let the image keep facing the player camera?
You do not need collection service here unless you have more parts which are the same as part A. Just try this (local script in starterGui)
local PartA = workspace.PartA
local char = game.Players.LocalPlayer
local image = — Put your image here, I’m assuming it’s a image label
game[“Run Service”].RenderStepped:Connect(function()
if (char.PrimaryPart.Position - PartA.Position).Magnitude < 100 then
image.Visible = true
else
image.Visible = false
end)
If you have any more questions, reply to this post to ask me
Generally render stepped causes less lag then while loops. I’ll supply some numbers to show you
wait() waits 1 ms which is 0.001s
the highest frame rate rn is 360 I think so 1/360 = 0.003s (3 d.p)
So RunService causes less lag