so my scripts are suppose to disable the controls which it does then switch the camera and only allow D and D to be pressed
the parts or scripts i have in my workspace:
CameraLineEnd <part CameraLinePos<part CameraLineStart<part LocalPlayerCameraPart<Part
that is suppose to allow the player camera to not go past the end and start pos
scripts:
playerenters main CameraControls CameraManipulation
CameraControls :
repeat wait (.1) until game.Workspace.LocalPlayerCameraPart local camobj = game.Workspace.LocalPlayerCameraPart function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.D then print("D was presssed") camobj.MovmentValue.Value = "Right" elseif inputObject.Keycode == Enum.Keycode.A then print ("A was pressed") camobj.Movementvalue.Value = "Left" end end function onKeyLet (inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.Keycode.D then print ("D was let") camobj.MovementValue.Value = "none" elseif inputObject.keycode == Enum.KeyCode.A then print ("A was let") camobj.MoveMentValue.Value = "none" end end game:GetService("UserInputService").InputBegan:connect(onKeyPress) game:GetService("UserInputService").InputEnded:connect(onKeyLet)
CameraManipulation :
local camera = game.Workspace.CurrentCamera local bool = false while true do wait() camera.CameraType = "Follow" if bool == false then bool = true part = Instance.new ("Part") part.Name = "LocalPlayerCameraPart" part.Anchored = true part.CanCollide = false part.Size = Vector3.new(1,1,1) part.CFrame = CFrame.new(game.Workspace.CameraLineStart.Position) part.Transparency = 1 part.Parent = game.Workspace part2 = Instance.new("Part") part2.Name = "localPlayerCameraPos" part2.Anchored = true part2.CanCollide = false part2.Size = Vector3.new(1,1,1) part2.CFrame =CFrame.new(game.Workspace.CameraLinePos.Position) part2.Transparency = 1 part2.Parent = game.Workspace local val = Instance.new ("StringValue") val.Parent = part val.Name = "MovementValue" val.Value = "none" local cammove = game.Workspace.CameraMovement:Clone() cammove.Parent = game.Players.LocalPlayer.PlayerGui cammove.Disabled = false end camera.CameraSubject = part camera.CoordniateFrame = part2.CFrame camera.FieldOfView = 50 end local cam = game.Workspace.LocalPlayerCameraPart local pos = game.Workspace.LocalPlayerCameraPos local val = cam.MovementValue local i = 1 while true do wait() local mag1 = (cam.Position - game.Workspace.CameraLineStart.Position).magnitude local mag2 = (cam.Position - game.Worksapce.CameraLineEnd.Position) .magnitude if val.Value == "left" then i = i + 1 if i < 50 then cam.CFrame = cam.CFrame - Vector3.new(0,0,(.02*i+.5) )pos.CFrame = pos.CFrame - Vector3.new(0,0,(.02*i+.5) ) else cam.CFrame = cam.CFrame - Vector3.new(0,0,1.5) pos.CFrame = pos.CFrame - Vector3.new(0,0,1.5) end end if val.Value == "right" then if mag2 > 0 then i = i + 1 print (i) if i < 50 then print ("first") cam.CFrame = Vector3.new (0,0,(.02*i)+.5) pos.CFrame = Vector3.new (0,0,(.02*i)+.5) else print("second") cam.CFrame = cam.CFrame + Vector3.new(0,0,1.5) pos.CFrame = pos.CFrame + Vector3.new(0,0,1.5) end end elseif val.Value == "none" then i = 1 end end camera.CameraSubject = part camera.CoordinateFrame = part2.CFrame camera.FieldOfView = 50
even though if nobody can help me with this i would love to thank everyone for atleast trying and looking at my thread :)
Please put the whole code in code block, thank you.