My fps framework aiming not working any way of fixing? (im not that good at scripting. Read desc)
Asked by
4 years ago Edited 4 years ago
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:
01 | local Player = game.Players.LocalPlayer |
02 | local camera = workspace.CurrentCamera |
03 | local VM = script.Arms:Clone() |
04 | local run = game:GetService( "RunService" ) |
06 | local Ammo = script.Ammo |
08 | local TS = game:GetService( "TweenService" ) |
12 | run.RenderStepped:Connect( function () |
14 | VM:SetPrimaryPartCFrame(VM:GetPrimaryPartCFrame():Lerp(camera.CFrame * CFrame.new( 0 ,- 1 , 0 ), 0.5 )) |
16 | local UIS = game:GetService( "UserInputService" ) |
17 | local mouse = Player:GetMouse() |
18 | UIS.InputBegan:Connect( function (key, proccessed) |
19 | if key.UserInputType = = Enum.UserInputType.MouseButton 1 and not proccessed then |
20 | game.Lighting.RemoteEvent:FireServer(mouse.Hit.Position) |
26 | UIS.InputBegan:Connect( function (i, p) |
27 | if i.UserInputType = = Enum.UserInputType.MouseButton 2 and not p then |
34 | UIS.InputEnded:Connect( function (i, p) |
35 | if i.UserInputType = = Enum.UserInputType.MouseButton 2 and not p then |
41 | if Aiming = = true then |
42 | VM:SetPrimaryPartCFrame(VM:GetPrimaryPartCFrame():Lerp(camera.CFrame * CFrame.new(- 4 ,- 1 , 0 ), 0.5 )) |
43 | elseif Aiming = = false then |
44 | VM:SetPrimaryPartCFrame(VM:GetPrimaryPartCFrame():Lerp(camera.CFrame * CFrame.new( 0 ,- 1 , 0 ), 0.5 )) |