i have this code that changes the cameras view and position once a player stands on a block, how do i reset the camera to its original settings when it touches a different brick?
local player = game.Players.LocalPlayer
----------------------------------------------
local function onMouseClick(player)
player.Character.Torso.CFrame = script.Parent.Parent.room1.Enter1.CFrame+ Vector3.new(0,1,0)
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local OFFSET = Vector3.new(-35,40,0)
local FIELD_OF_VIEW = 25
local player = Players.LocalPlayer
local camera = game.Workspace.CurrentCamera
camera.FieldOfView = FIELD_OF_VIEW
local function onRenderStep()
local character = player.Character
if character then
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if humanoidRootPart then
local playerPosition = humanoidRootPart.Position
local cameraPosition = playerPosition + OFFSET
camera.CoordinateFrame = CFrame.new(cameraPosition, playerPosition)
end
end
end
RunService:BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value, onRenderStep)
---------------------------
end
script.Parent.Door1.ClickDetector.MouseClick:connect(onMouseClick)
