Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to have a part cframe move away from you?

I'm trying to make cartoon effects to this tiny map, where the border of the block is black. You should never see a black part in front of any part. How do you do this to the camera?

So far, this is what I managed. Yet, the parts stay and don't move away from the cam.

local plr=game.Players.LocalPlayer.Character
local cam=Workspace.CurrentCamera
game:GetService('RunService').Stepped:connect(function()
	if cam:findFirstChild("Carto")~=nil then
		cam.Carto:Destroy()
	end
	n=Instance.new("Model",cam) n.Name="Carto"
	local all=Workspace.Model:getChildren()
	for a=1,#all do
		local p=all[a]:Clone()
		p.CFrame=all[a].CFrame+Vector3.new(cam.CoordinateFrame)
		p.Parent=cam.Carto
	end
end)

2 answers

one guy told me on the Forums once, get the Torso.CFrame.lookVector and then it will face that direction, so if it's in front of u, u can set it to Face were ur Torso is facing, orif it's behind then, were ur back is facing, and so on...

1 comment

0

uhhh... am NOOB-Sick! NOOBS = Me Sick!

You can find the direction from the players head towards the block, and then move the "outline" 0.5-1 stud away.

function getdir(head, outline)
	dir = (head.Position - outline.Position).unit
	outline.Position = part.Position + 0.5(dir)
end

I don't know a whole lot about the camera (almost nothing) but if the camera has a "position" than you can substitute the camera's position for the head's position.

This discussion is preserved as it was. New answers, comments, and votes are closed.