|
| 02 Jul 2015 06:40 PM |
I am a beginner with scripting and I need help with my gun script I made that makes the first person gun model follow the camera. The only issue is it doesn't have good smooth movement. And I don't know what to do to improve it. Here's the script.
local Gun = script.Parent local Handle = Gun:WaitForChild("Handle") local Player = game.Players.LocalPlayer local Camera = game.Workspace.CurrentCamera local Mouse = Player:GetMouse() local oldMouseHit = Mouse.Hit.p
function OnEquip()
local weld1 = Instance.new("Weld") weld1.Parent = game.JointsService weld1.C1 = Player.Character.Head.CFrame:toObjectSpace(Player.Character.Torso.CFrame) weld1.Part0 = Player.Character.Torso weld1.Part1 = Player.Character.Head
local weld2 = Instance.new("Weld") weld2.Parent = Player.Character.Head weld2.Part0 = Player.Character.Head weld2.Part1 = Handle weld2.C0 = CFrame.new(.7, -1.4, -1.7) game:GetService("RunService").RenderStepped:connect(function() weld1.C1 = CFrame.new(Player.Character.Head.CFrame.p,oldMouseHit):toObjectSpace(Player.Character.Torso.CFrame) oldMouseHit = Mouse.Hit.p end) end Gun.Equipped:connect(OnEquip)
|
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Jul 2015 01:46 AM |
| You can make it first person by changing starterplayer properties for camera |
|
|
| Report Abuse |
|
|
|
| 19 Jul 2015 05:02 PM |
| That's not what I wanted. I wanted the gun parented to the camera in first person. So when you look around the gun stays in the same spot on the screen. But thanks for that info. |
|
|
| Report Abuse |
|
|