Ok so i tried making aiming for my fps framework game. But the aiming only works if i use auto clicker at left click then i hold right click and it works. But when i don't use auto clicker it just aims for a millisecond. (i watched yt tutorials btw) Script:

local Player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local VM = script.Arms:Clone()
local run = game:GetService("RunService")
local Aiming = false
local Ammo = script.Ammo
local shooting = false
local TS = game:GetService("TweenService")


	
run.RenderStepped:Connect(function()
	VM.Parent = camera
	VM:SetPrimaryPartCFrame(VM:GetPrimaryPartCFrame():Lerp(camera.CFrame * CFrame.new(0,-1,0),0.5))
	end)
local UIS = game:GetService("UserInputService")
local mouse = Player:GetMouse()
UIS.InputBegan:Connect(function(key, proccessed)
	if key.UserInputType == Enum.UserInputType.MouseButton1 and not proccessed then
		game.Lighting.RemoteEvent:FireServer(mouse.Hit.Position)
		
	end
end)


UIS.InputBegan:Connect(function(i, p)
		if i.UserInputType == Enum.UserInputType.MouseButton2 and not p then
			Aiming = true
	end
	end)
	
	
	
	UIS.InputEnded:Connect(function(i, p)
		if i.UserInputType == Enum.UserInputType.MouseButton2 and not p then
				Aiming = false
	end
		
     
	
		if Aiming == true then
			VM:SetPrimaryPartCFrame(VM:GetPrimaryPartCFrame():Lerp(camera.CFrame * CFrame.new(-4,-1,0),0.5))
		elseif Aiming == false then
		VM:SetPrimaryPartCFrame(VM:GetPrimaryPartCFrame():Lerp(camera.CFrame * CFrame.new(0,-1,0),0.5))
end
end)

2 comments

0

That looks kinda complez for someone who doesn't know scripting that much :/

0

i did watch youtube tutorials