So, basically I am making a brick that when a tool is equipped the brick will be infront of the player. Also if he changes position, I tried to use
player.Character.Head.Position.Changed:Connect(function() end)
But as I have found out you cannot use a changed event on a position (or can you?). What other way can I use to always have the brick infront of player.
BTW, I know like how to have position and placing the brick, but how can I have the brick always infront and not the first position value?
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 = --whatever part you want to place in front of the player 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)
Use Cframe Read Wiki http://wiki.roblox.com/index.php?title=CFrame