I am making a gun that points towards your mouse in first person. It works perfectly besides the fact that it seems the guns lagging really bad :d. I tried renderstepped and it seems nothing happened, heres the scripts, thanks if you help!
heres the gun if you want to see the lag http://www.roblox.com/Border-Conflict-place?id=180698731
local player = game.Players.LocalPlayer
local body = player.Character
local mouse = player:GetMouse()
while true do
Game:GetService("RunService").RenderStepped:wait()
body.Torso.Neck.C1 = CFrame.new()
body.Torso.Neck.C0 = CFrame.new(0, 1.5, 0) * CFrame.Angles(math.asin((mouse.Hit.p - mouse.Origin.p).unit.y), 0, 0)
xangle = -math.asin((mouse.Hit.p - mouse.Origin.p).unit.y)-1.7
new = math.asin((mouse.Hit.p - mouse.Origin.p).unit.y)
if new >0
then
script.Parent.Parent.GripPos = Vector3.new(0,new*1,-new*1.2-.4)
else if new <0
then
script.Parent.Parent.GripPos = Vector3.new(0,0,-new*.9-.4)
end
end
body.Torso:FindFirstChild("RightArmWeld").C1 = CFrame.new(-1.5,.5,.5)*CFrame.Angles(xangle,0,0)
Game:GetService("RunService").RenderStepped:wait()
end
