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

Help with cameras?

Im trying to make this touched function that changes the player cameratype to "Watch" Can somebody help me?

function cam(part)
if part.Parent:findFirstChild("Humanoid") then
print("Works")
camclone = game.Workspace.CurrentCamera:clone()
camclone.Parent = (part.Parent.Backpack)
camclone.CameraType = "Watch"
end
end
script.Parent.Touched:connect(cam)

1 answer

You can only access the player's camera via LocalScripts, try this:

--LocalScript in backpack perhaps

local player = game.Players.LocalPlayer
local character = player.Character
local camera = Workspace.CurrentCamera

camera.CameraType = "Custom" -- Need to reset the camera every time the player respawns.

character["Left Leg"].Touched:connect(function(obj)

	if obj == Workspace.Part then -- whatever you need to touch

		camera.CameraType = "Watch"

	end

end)

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