Hey!
Thanks for taking the time to view my post.
I need to fix an issues with my click detectors as they are not detector Mouse1 clicks when the camera is in scriptable mode.
The ClickDetector that is assigned to the fusebox switch is functioning normally when the player’s camera is in its default follow mode, however, when the camera switches to a scriptable mode and moves to a certain position, the detectors no longer detect anything.
I’ve uploaded a video showing my problem and here is the code that is controlling the camera through a localScript in StarterGui
I actually dont know what the proper course of action is, any help is appreciated.
local uis = game:GetService("UserInputService")
local camPart = game.Workspace:WaitForChild("camPart")
local camera = game.Workspace:WaitForChild("Camera")
local fusebox = game.Workspace.Fusebox
local prox = fusebox.ProxPrompt.ProximityPrompt
local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local toggle = false
prox.Triggered:Connect(function() -- triggered from proximity prompt
camera.CameraType = Enum.CameraType.Scriptable
local tween = game:GetService("TweenService"):Create(camera, TweenInfo.new(1), {CFrame = camPart.CFrame + Vector3.new(2,0,0)})
tween:Play()
Char:WaitForChild("HumanoidRootPart").Anchored = true
--teleports the player away
Char:WaitForChild("HumanoidRootPart").CFrame = Char:WaitForChild("HumanoidRootPart").CFrame + Vector3.new(100,100,100)
toggle = true
end)
uis.InputBegan:Connect(function(input)
if toggle == true then
if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.D then
camera.CameraType = Enum.CameraType.Follow
Char:WaitForChild("HumanoidRootPart").Anchored = false
--teleports the player back
Char:WaitForChild("HumanoidRootPart").CFrame = Char:WaitForChild("HumanoidRootPart").CFrame - Vector3.new(100,100,100)
toggle = false
end
end
end)