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

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local RemoteEvent = game.ReplicatedStorage.RemoteEvent
repeat wait() until Player.Character
local Char = Player.Character

Mouse.Move:Connect(function()
    local Head = Player.Character.Head
    local Vec = Mouse.CFrame

    local Neck = Head.Neck
    RemoteEvent:FireServer(Neck, Vec)
end)

SERVERSCRIPT

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

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