I am trying to make a sort of 'fog' in my game by using an inverted sphere and having it attached to the players camera so i don't have to use any physics.
The problem I am running into is that the parts after they are made no longer update their position, so they are just in one spot. How do i make it so they are always attached to the player's position?
Here is the code:
Player = game.Players.LocalPlayer
Character = Player.Character or Player.CharacterAdded:wait()
wait() hrp = Character:FindFirstChild("HumanoidRootPart")
--creating the fog
fogholder = Instance.new("Part", game.Workspace.CurrentCamera)
fog = Instance.new("SpecialMesh", fogholder)
fogholder.Anchored = true
fogholder.CanCollide = false
fogholder.Size = Vector3.new(0,0,0)
fogholder.BrickColor = BrickColor.new(255,255,255)
fogholder.CFrame = CFrame.new(hrp.Position.X, hrp.Position.Y, hrp.Position.Z)
fog.MeshId = "http://www.roblox.com/asset/?id=1185246"
fog.MeshType = "FileMesh"
fog.Scale = Vector3.new(-250,-250,-250)
Also, I don't want the fog to rotate at all.

4 comments
Thanks! this worked, not sure why but loops completely slipped my mind. Just for future reference, as i am quite new to scripting, how would i bind it to RenderStepped?
Dun, check edit.
Thanks! Ill have to look into that stuff more. It runs much smoother compared to the while loop.
Yep, RenderStepped runs each frame the client renders, while wait() waits for a minimum of .03 seconds, which is roughly two frames.