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

I dont get Cframes i started learning it today can someone help?

Im trying to make a script in which when players touch an object there camera is the position of a part i put this is a local script:

local Camera = script.Parent.CameraWhenHiding.CFrame
local humanoid = game.Players.LocalPlayer:WaitForChild("HumanoidRootPart").CFrame

local TrashCan = script.Parent

TrashCan.Touched:Connect(function(hit)
	humanoid = Camera
	
end)

1 answer

✓ Accepted answer

Almost!

You can do this to make it work:

local humanoid = game.Players.LocalPlayer:WaitForChild("HumanoidRootPart").CFrame

local TrashCan = script.Parent

TrashCan.Touched:Connect(function(hit)
	workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable 
 	 workspace.CurrentCamera.CFrame = script.Parent.CameraWhenHiding.CFrame
end)

And so you know, CFrames are special values that store both rotational and positional data. They are helpful because they have some unique functions and values, like LookVector.

12 comments

0

It didnt work when i touched the trashcan my view didnt change to the part

0

I edited it,

0

Still doesnt work my camera doesnt turn to what the CurrentCamera sees

0

What are you trying to do?

0

When i touch the trash can i want my camera to seewhat the CameraWhenHiding sees

0

I edited it again

0

It still didnt work nothing happened

0

edited it AGAINN

0

Still didnt work xd

0

Anything in the output?

0

NOTHING IN THE OUTPUT

0

ILL ACCEPT IF IT WORKS :)

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