Changing Camera Cframe to a Spacific part.Cframe

I think the second script is not working.

is it supposed to be CFrame not “Cframe”?

1 Like

You arent setting the CameraType to Scriptable.

1 Like

Ah right, I will make it scriptable and try again.

I have changed the client script to this. But not working and also In the second script I mentioned in the thread (server event script) I have added a print section where is it supposed to say pressed C whenever I successfully fire to the client but it is not popping up in the output tab.


local Camera = workspace.CurrentCamera
local part = workspace:WaitForChild("sakuracam1")



game.Players.LocalPlayer:WaitForChild("CARCAMERA").OnClientEvent:connect(function()
	repeat Camera.CameraType = Enum.CameraType.Scriptable wait() until Camera.CameraType == Enum.CameraType.Scriptable
	
	Camera.Cframe = part.Cframe
	print("camera to cframe")
	
	
	
end)

Here is a little something I made that can change the camera

Edit: you don’t need a server script for the camera, just local

1 Like

Yes, I changed it to CFrame but no luck.

local Camera = workspace.CurrentCamera
local part = workspace:WaitForChild("sakuracam1")



game.Players.LocalPlayer:WaitForChild("CARCAMERA").OnClientEvent:connect(function()
	
	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.CFrame = part.CFrame
	print("camera to cframe")
	
	
	
end)

how about this

1 Like

Yes, this script is perfect, but I think the problem is In the second script I mentioned in the thread (server event script) I have added a print section where is it supposed to say pressed C whenever I successfully fire to the client but it is not popping up in the output tab. So I think it is not firing to the clint event.

where does the RemoteEvent placed tho?

But I wanted to make sure that the camera only moves to that specific vehicle part only when a player is driving.

Screenshot_58
Here

game.ReplicatedStorage:WaitForChild("CARCAMERA").OnClientEvent:connect(function()

second script?

1 Like

I have updated the clint side script to this

local Camera = workspace.CurrentCamera
local part = workspace:WaitForChild("sakuracam1")



game.ReplicatedStorage:WaitForChild("CARCAMERA").OnClientEvent:connect(function()

	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.CFrame = part.CFrame
	print("camera to cframe")



end)

And this is the server event script that fires to the client

local userInput = game:GetService("UserInputService")


script.Parent.Touched:Connect(function(hit)
	

		local player = game.Players:GetPlayerFromCharacter(hit.Parent)

		userInput.InputBegan:Connect(function(key, processed)
			if processed then
				return
			end

			if key.KeyCode == Enum.KeyCode.C then
			game.ReplicatedStorage["CARCAMERA"]:FireClient(player)
			
			print("Pressed C")
			
		end	
		end)
	
		
			

	
end)
1 Like

does it work? does it have any errors?

It doesn’t work and when I am pressing C it is not printing this to the output.
Screenshot_59

if processed then
				return
			end

try removing this line

1 Like

here this might help

I removed it, but it still not working.

In the second script the input began function shouldn’t work because User Input Service is client side only.