I'm making a script that makes the head follow the mouse. AANNNND...
I've been receiving this error; CFrame is not a valid member of PlayerMouse
How would i then go about solving this problem?
01 | local Player = game.Players.LocalPlayer |
02 | local Mouse = Player:GetMouse() |
03 | local RemoteEvent = game.ReplicatedStorage.RemoteEvent |
04 | repeat wait() until Player.Character |
05 | local Char = Player.Character |
06 |
07 | Mouse.Move:Connect( function () |
08 | local Head = Player.Character.Head |
09 | local Vec = Mouse.CFrame |
10 |
11 | local Neck = Head.Neck |
12 | RemoteEvent:FireServer(Neck, Vec) |
13 | end ) |
1 | local Remote = game.ReplicatedStorage.RemoteEvent |
2 | Remote.OnServerEvent:Connect( function (player, Neck, Vec) |
3 | for i = 0 , 1 ,. 01 do |
4 | wait() |
5 | Neck.C 0 :lerp(Vec, i) |
6 | end |
7 | end ) |
Mouse.CFrame doesn't exist That's wrong
The correct thing to use is Mouse.Hit (game.Players.LocalPlayer:GetMouse().Hit)
What is mouse.Hit you ask?
it is a property indicates CFrame of the mouse’s position in 3D space
There is also a Vector3 Position
game.Players.LocalPlayer:GetMouse().Hit.p
For More Info: https://developer.roblox.com/en-us/api-reference/property/Mouse/hit