I’m trying to stick with what I understand to make this work, and I haven’t fully understood the use of TargetPoint, maybe there is a simpler substitute for this script?
local pos = plr.Character.Humanoid.TargetPoint
local LookAt = (pos - plr.Character:WaitForChild("RightGatlingGun").MainTip.Position).Unit
Note: My character isn’t a r15/r6 build model. It’s a bot like structure.
The TargetPoint is the position of the latest click with your mouse (or tap if on mobile) while holding a tool (in this case, the gun). If you want an exact substitute, you need to create a variable that stores the position of the last click. Then, the variable will be updated whenever the player clicks while holding the gun. Maybe something like this:
-- Untested code
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local targetPoint = Vector3.new(0, 0, 0)
UIS.InputBegan:Connect(function(input, GPE)
if GPE then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 then
targetPoint = mouse.Hit.Position
end
end)
But considering that Roblox already has a built-in variable for this, if what I described at the top is what you wanted, I would stick to Humanoid.TargetPoint.