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

How do I get only the x Value of the mouse? [Not Solved]

Player = Game.Players.Player1
Mouse = Player:GetMouse()

while true do
local person = game.Workspace.Player1
if person ~= nil then
script.Parent.BodyGyro.cframe = Mouse.Hit.X ----Here
end
wait()
end

For those who wonder, when printed it gives you a big number like.

61.6526031, -0.00999999046, -81.8329086, 0.8998546, 0.313777715, -0.302993745, -0, 0.69463712, 0.719360292, 0.43618995, -0.647319674, 0.62507242

When in the Wiki it states its only a X and Y value...

4 comments

0

Are you trying to get the X value on the screen, or are you just trying to make a new CFrame with the hit's X value?

0

When I remove the X the brick faces where the mouse points (Useful for 1st person shooters) But the problem is I don't need the brick to rotate vertically. Which is why I only need the X value.

0

You're still not being very clear. It'd be a lot easier to help if you described exactly what you want to happen using clear terminology.

0

Okay, I'm making a 3rd person FPS. When aiming the body will follow the mouse target, but I don't want the morph to lean along the Y axis.

1 answer

..., mouse.Hit.X is 1 number, try CFrame.new(Mouse.Hit.X,0,0)

1 comment

0

It doesnt give me an error but it does nothing now.

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