Right now, when I walk towards the objects, they appear as i get closer. I want them to dissapear as i get closer but I’m not too sure what i did wrong with clamps or anything. Can anyone help?
local player = game.Players.LocalPlayer
local MinDistance = 0
local MaxDistance = 15
game:GetService("RunService").Heartbeat:Connect(function()
local character = player.Character or player.CharacterAdded:Wait()
local humanoidP = character.PrimaryPart
for _, part : MeshPart in game.Workspace.trail:GetChildren() do
local distance = (humanoidP.Position - part.Position).Magnitude
part.Transparency = math.clamp(distance, MinDistance, MaxDistance) / MaxDistance
print(distance)
end
end)
RunService Seems to be the problem or something like that try to do the same thing and mess around with it try to figure out what may be wrong with it it can be a small debug