✓ Accepted answer
You can find out more here, but after bit of testing, I find that this probably works the best:
local thing = Instance.new("Part")
thing.Size = Vector3.new(1,1,1)
thing.Anchored = true
thing.BrickColor = BrickColor.Red()
thing.Parent = workspace
game:GetService("RunService").RenderStepped:Connect(function()
thing.CFrame = CFrame.new(script.Parent:GetPrimaryPartCFrame() * Vector3.new(0,0,-5))
end)
This local script is in the player character, I do not recommend doing some of the things I'm doing in this script as this was hastily thrown together to show how to do this. But the only line that you should use is line 7 as that places it 5 studs in front of the humanoid root part.
So, a basic explanation on what this does:
It first creates a 1x1x1 red part and every frame, it puts the thing in front of the player.
So, as incapaz said, "position does not fire changed", so other things can be used. For example: the HeartBeat, Renderstepped, and Stepped functions of runservice, and the while loop.
Also, I would recommend using a local script to avoid the latency that comes with remote functions and remote events
Ex:
local thing =
local head = game.Players.LocalPlayers.Charcter:FindFirstChild("Head")
local rs = game:GetService("RunService")
rs.RenderStepped:Connect(function()
if head then
thing.CFrame = CFrame.new(head.CFrame * Vector3.new(0,0,-5))
end
end)
2 comments
No. You cannot. Position does not fire changed. In fact the properties that relate to physics don't change, like in your example Position.
But how can I do it then?