i made a player look at mouse system for my top down game, but the problem is that the gun shoot where the right arm is, meaning the bullet is not going the way of the mouse, so how would I make my script right arm?
local Player = game:GetService("Players").LocalPlayer
local Mouse = Player:GetMouse()
Mouse.TargetFilter = workspace
repeat wait() until Player.Character; local Character = Player.Character
game:GetService("RunService").RenderStepped:connect(function()
Character:WaitForChild("Torso").CFrame = CFrame.new(Character.Torso.CFrame.p, Vector3.new(Mouse.Hit.X, Character.Torso.CFrame.p.Y, Mouse.Hit.Z))
end)
I tried this but it spits out a lot of errors
local Player = game:GetService("Players").LocalPlayer
local Mouse = Player:GetMouse()
repeat wait() until Player.Character; local Character = Player.Character
local right = Character:WaitForChild("RightArm")
game:GetService("RunService").RenderStepped:connect(function()
right.CFrame = CFrame.new(right.CFrame.p, Vector3.new(Mouse.Hit.X, right.CFrame.p.Y, Mouse.Hit.Z))
end)
local Player = game:GetService("Players").LocalPlayer
local Mouse = Player:GetMouse()
repeat wait() until Player.Character; local Character = Player.Character
local right = Character:WaitForChild("RightArm")
Mouse.Move:connect(function()
right.CFrame = CFrame.new(right.CFrame.p, Vector3.new(Mouse.Hit.X, right.CFrame.p.Y, Mouse.Hit.Z))
end)