Hello. Im Working on a hunting rifle gun that would shoot after I fixed the aiming problem
my exact problem is that player CAN aim but CANT move the gun up, down, left and right while aiming here is my script:
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Character = Player.Character
local Enabled = false
local Anim
Mouse.Button2Down:Connect(function()
Enabled = true
if script.Parent.Parent:IsA("Model") then
Anim = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Aim)
Anim:Play()
end
end)
Mouse.Button2Up:Connect(function()
Enabled = false
Anim:Stop()
end)
game:GetService("RunService").Heartbeat:Connect(function()
if script.Parent.Parent:IsA("Model") then
if Enabled == true then
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
game.Workspace.CurrentCamera.CFrame = script.Parent.AimPart.CFrame
else
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
end
else
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
if Aim ~= nil then
Anim:Stop()
end
end
end)
I am not good at making fps games I never touched custom camera but I think because its custom camera you have to add something that follow your Mouse Sight
(edit)
make CFrame make camera follows mouse sight
use the mouse sight to move the camera because you are using custom camera you have to make every thing by your self
(I’m new scripter so I don’t know how to make this kind of stuff)
search on youtube about custom camera
Try multiplying the cam CF with the aimpart CF instead of directly setting it to the aim thing CFrame (workspace.CurrentCamera.CFrame *= script.Parent.AimPart.CFrame). Because you are setting the CFrame of the camera directly to the CFrame of the aim thing, you lose control over the camera.