I'm kind of practicing my skills on a gun, and I want the gun to point at my mouse. Here's what I got for now:
local user = nil local player = nil script.Parent.Equipped:connect(function(mouse) user = script.Parent.Parent player = game.Players:GetPlayerFromCharacter(user) player.CameraMode = "LockFirstPerson" while wait() do script.Parent.Handle.CFrame = CFrame.new(script.Parent.Handle.Position, user.Humanoid.TargetPoint) end end) script.Parent.Unequipped:connect(function() if player ~= nil then player.CameraMode = "Classic" end end)
Clean, no errors. But it follows my mouse, and my character's going forward. It's annoying, and would make me fall down from the BasePlate and die. Changing while wait() do end
to something such as script.Parent.Handle.Changed:connect(function() end)
or adding gyro, would be nice ideas, but I tried script.Parent.Handle.Changed:connect(function() end)
and it didn't work, and adding gyro'd make it unable to jump.
Any ideas?
Thanks,
SwaggyDuckie.