How to use mouse.hit.LookVector as a CFrame? (for a stone attack)
Hi, I'm scripting a stone attack for my magic ffa game, I'm good at this sorta thing but you could search the entire planet and still not find a scripter my level who's as awful at CFrame as me.
So, I was wondering. How would I turn a vector3 into a CFrame?
Here's a server script that handles the attack thing:
01 | script.Parent.OnServerEvent:connect( function (player, mouse) |
02 | if game.Players [ player.Name ] .Character.HumanoidRootPart:FindFirstChild( "AimerGyro" ) then |
04 | local gryo = game.Players [ player.Name ] .Character.HumanoidRootPart:FindFirstChild( "AimerGyro" ) |
08 | local g = Instance.new( "BodyGyro" ) |
10 | g.Parent = game.Players [ player.Name ] .Character.HumanoidRootPart |
To clarify, that mouse variable is mouse.hit sent over from the client.
And here is that client script:
01 | local uis = game:GetService( "UserInputService" ) |
03 | local attacking = false |
05 | local debounce 2 = false |
06 | local mouse = game.Players.LocalPlayer:GetMouse() |
08 | script.Parent.Equipped:connect( function () |
12 | script.Parent.Unequipped:connect( function () |
16 | uis.InputBegan:connect( function (input, gp) |
20 | if input.KeyCode = = Enum.KeyCode.Q and not attacking and not debounce then |
26 | script.Parent.StoneQ:FireServer(mouse.hit) |
40 | uis.InputEnded:connect( function (input, gp) |
44 | if input.KeyCode = = Enum.KeyCode.Q and attacking and not debounce 2 then |