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

How do I easily detect mouse position? (Model)

so, I am trying to make a placement system and I keep trying to get the mouse position. I am trying to only use the Y position for this. I've tried this

workspace.Handgunner.Position = Mouse.Position

and I could not find anything that would help.

2 comments

1

Change mouse.Position to mouse.Hit.Position

0

wth I just use mouse.Hit.p

2 answers

✓ Accepted answer

Like YoutubeMaster Said, mouse.Hit.Position, returns a CFrame, and as you said, the HandGunner is a model, so you would need to do:

workspace.HandGunner.PrimaryPart.CFrame = mouse.Hit

That should work. All it does is just move the models primary part to the mouse.Hit CFrame Or you could do:

workspace.HandGunner:SetPrimaryPartCFrame(mouse.Hit)

2 comments

0

Say Mouse.Hit.CFrame lol

0

Mouse hit is a CFrame itself.

As 14zanderbilt, change Mouse.Position to Mouse.Hit.Position. Mouse.Hit returns a CFrame. CFrames have a property called "Position", which gets the Vector3 of the CFrame.


Fixed Part:

workspace.Handgunner.Position = Mouse.Hit.Position

6 comments

0

property, not value :P

0

tried that

0

Sorry. I guess I "mixed up" my words.

0

Wouldn't that just return what @VortexGamingPlayerYT said? He got an error saying, that when he ran that code, it syas "Vector3 Expected"

0

@VortexGamingPlayerYT Does it give you an error? What are you trying to accomplish? Please be more descriptive while posting a question.

0

ok so it doesnt error just gives a weird problem

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