This script makes a part follow you. This script works fine but I want the part to be 10 studs above the chars head or torso. This script is in a part btw.
function onPlayerEntered(player) player.CharacterAdded:connect(function(char) while wait() do script.Parent.CFrame = CFrame.new(char.Torso.Position) end end) end game.Players.PlayerAdded:connect(onPlayerEntered)
In order for the part to be 10 studs above the character then you need to specify the point of origin, and the offset from that origin. Then set the part's CFrame to the origin's position, multiplied by the offset. In this case, the origin would be your character's Torso, and the offset would be CFrame.new(0,10,0)
.
function onPlayerEntered(player) player.CharacterAdded:connect(function(char) while wait() do local origin = char:WaitForChild("Torso").CFrame local offset = CFrame.new(0,10,0) script.Parent.CFrame = origin * offset end end) end game.Players.PlayerAdded:connect(onPlayerEntered)