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

How do I easily detect mouse position? (Model) [closed]

Asked by
VVoretex 146
4 years ago
Edited 4 years ago

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.

1
Change mouse.Position to mouse.Hit.Position Cynical_Innovation 595 — 4y
0
wth I just use mouse.Hit.p greatneil80 2647 — 4y

Locked by PrismaticFruits, JesseSong, and Fifkee

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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)
0
Say Mouse.Hit.CFrame lol PrismaticFruits 842 — 4y
0
Mouse hit is a CFrame itself. Cynical_Innovation 595 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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
0
property, not value :P Filipalla 504 — 4y
0
tried that VVoretex 146 — 4y
0
Sorry. I guess I "mixed up" my words. youtubemasterWOW 2741 — 4y
0
Wouldn't that just return what @VortexGamingPlayerYT said? He got an error saying, that when he ran that code, it syas "Vector3 Expected" Cynical_Innovation 595 — 4y
View all comments (2 more)
0
@VortexGamingPlayerYT Does it give you an error? What are you trying to accomplish? Please be more descriptive while posting a question. youtubemasterWOW 2741 — 4y
0
ok so it doesnt error just gives a weird problem VVoretex 146 — 4y