so can anyone make script that when click on part, player camera viewpoint will following/stick on the part, I want to recreate some cool thing that my project was lose
Create a server script which should be inside your chosen part:
local part = script.Parent
local clickDetector = part:FindFirstChild("ClickDetector") or Instance.new("ClickDetector")
clickDetector.Parent = part
local replicatedStorage = game:GetService("ReplicatedStorage")
local cameraEvent = replicatedStorage:WaitForChild("Camera")
clickDetector.MouseClick:Connect(function(plr)
cameraEvent:FireClient(plr, part)
end)
Now, create a RemoteEvent in ReplicatedStorage named “Camera”.
Finally, attach a local script in StarterPlayer → StarterCharacterScripts with:
local replicatedStorage = game:GetService("ReplicatedStorage")
local cameraEvent = replicatedStorage:WaitForChild("Camera")
local camera = workspace.CurrentCamera
cameraEvent.OnClientEvent:Connect(function(part)
if camera.CameraSubject == part then
camera.CameraSubject = script.Parent.Humanoid
camera.CameraType = Enum.CameraType.Custom
return
end
camera.CameraSubject = part
camera.CameraType = Enum.CameraType.Follow
end)
If you click the part, your camera will start following it. If you click the same part again, it will start following you again.
You’re duplicating the part locally, which is why it’s not working (Server scripts don’t work locally).
You should duplicate it in the server via Test → Current: …
The current view is located right beside the Play Button in the far left. When pressed, it will display either Client or Server.
To access the “Current View”, you have to press Play.
P.S. If you’re trying to get the same type of CameraType as Babft, I suggest using Enum.CameraType.Track instead of Enum.CameraType.Follow in your local script.
completely unrelated but you should probably learn and not just ask for scripts and how to do things. can’t just keep making new topics like your newest one:
i sense that you’re a beginner, and that’s ok. but again, it’s best you start learning on your own (with possible help from the forum) and then gain knowledge. then you can truly let out your own ideas!
I put camera script on part that will clone itself then following player
I did replace “Enum.CameraType.Follow” to “Enum.CameraType.Track” in local script