Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

CFrame is not a valid member of PlayerMouse? [qwertyuiop]

Asked by 4 years ago
Edited 4 years ago

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?

LOCAL SCRIPT

01local Player = game.Players.LocalPlayer
02local Mouse = Player:GetMouse()
03local RemoteEvent = game.ReplicatedStorage.RemoteEvent
04repeat wait() until Player.Character
05local Char = Player.Character
06 
07Mouse.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)
13end)

SERVERSCRIPT

1local Remote = game.ReplicatedStorage.RemoteEvent
2Remote.OnServerEvent:Connect(function(player, Neck, Vec)
3    for i = 0,1,.01 do
4        wait()
5        Neck.C0:lerp(Vec, i)
6    end
7end)

1 answer

Log in to vote
1
Answered by
Zero_Tsou 175
4 years ago
Edited 4 years ago

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

0
Incredible job! ITS CONGRATULATIONS ITS A CELEBRATION PARTY ALL DAY ALL YOU'VE BEEN WAITIN maxpax2009 340 — 4y
0
:)) Thank you! Zero_Tsou 175 — 4y
Ad

Answer this question