Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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

2 comments

0

Incredible job! ITS CONGRATULATIONS ITS A CELEBRATION PARTY ALL DAY ALL YOU'VE BEEN WAITIN

0

:)) Thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.