You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
A system in which when I press E it moves the camera to a part called “AimPart”
- What is the issue? Include screenshots / videos if possible!
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have gotten a script but it does not work:
-- Variables
local aimPart = workspace:WaitForChild("AimPart") -- Assumes the part is named "AimPart"
local camera = game.Workspace.CurrentCamera
-- Function to move the camera to the AimPart's position
local function moveCamera()
local aimPosition = aimPart.Position
camera:Interpolate(CFrame.new(camera.CFrame.Position, aimPosition), CFrame.new(aimPosition), 1) -- Adjust the interpolation speed as desired
end
-- Connect the function to a desired event that triggers the camera movement
-- For example, you can connect it to a button click event or a keyboard key press event
-- Here's an example of connecting it to the 'E' key press event
game:GetService("UserInputService").InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
moveCamera()
end
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.