-
What do you want to achieve?
Im trying to make a system where while the player Is holding a certain key he’s constantly facing his mouse. (like those anime aiming systems) -
What is the issue?
I need a alternative to anchoring and body position to make the character hover if he’s in midair while holding the specific key, If I anchor it then the bullet projectile only fires in 1 direction, and if I use body position then for some reason it doesn’t let me look up or down, only sideways -
What solutions have you tried so far?
I’ve searched across dev forum and asked for help in the hidden developers discord
Heres my Local Script
local Position = Root.Position
if input.KeyCode == Enum.KeyCode.Z then
remote:FireServer("Water", "QuickAttack", "Began", Mouse.hit)
Holding = true
Root.Anchored = true
local function Aim()
while Holding do
wait()
Root.CFrame = CFrame.new(Root.Position, Mouse.hit.Position)
end
end
spawn(Aim)
end
Heres my Server Script
if Move == "QuickAttack" then
for i = 1,20 do
local Clone = script.Bullet:Clone()
local bv = Instance.new("BodyVelocity", Clone)
bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bv.Velocity = root.CFrame.lookVector * 100
Clone.CFrame = (CFrame.new(Char.PrimaryPart.CFrame.Position+(5*Char.PrimaryPart.CFrame.LookVector),Char.PrimaryPart.Position))*CFrame.Angles(0, math.rad(180), 0)
local V3 = Vector3.new(Mouse.p.x,Mouse.p.y, Mouse.p.z)
local ray = Ray.new(root.Position, V3)
Clone.Parent = workspace
for i,v in pairs(hum:GetPlayingAnimationTracks())
do
v:Stop()
end
local hitPart, hitPosition = workspace:FindPartOnRay(ray, Char)
if hitPart then
print(hitPart:GetFullName())
end
wait(0.05)
end
end```