Hello, I have recently tried CameraManipulation and want to trigger it with a part in workspace. I want it so it triggers when a player touches the TriggerPart and stops when the player moves away from the TriggerPart. I am having difficulty with scripting this and need some help.
To give you a basic idea: -There is a part in workspace called CamPart (The one that is used for the camera, Not as a trigger.) -Part in workspace called TriggerPart. (Used for triggering the script when a player touches.) -ScreenGUI in StarterGUI with a LocalScript.
The script in StarterGUI is as follows:
local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Camera = workspace.CurrentCamera repeat wait() Camera.CameraType = Enum.CameraType.Scriptable until Camera.CameraType == Enum.CameraType.Scriptable Camera.CFrame = workspace.CamPart.CFrame
Thank you for your time!
here. - PUT IN A PART (INVISIBLE + NOCOLLIDE)
local debounce = false function TouchEvent(Trigger) if debounce == false and Trigger.Parent:FindFirstChild("Humanoid") then local Player = game.Players[Trigger.Parent.Name] local Character = Player.Character or Player.CharacterAdded:Wait() local Camera = workspace.CurrentCamera debounce = true repeat wait() Camera.CameraType = Enum.CameraType.Scriptable until Camera.CameraType == Enum.CameraType.Scriptable Camera.CFrame = workspace.CamPart.CFrame end end script.Parent.Touched:Connect(TouchEvent)
Camera manipulation is local so you would have to either use a RemoteEvent that triggers the client when touching the part, or have a LocalScript that detects when your player touches anything, checks if it's the right part, then it manipulates the camera.