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

Part isn't detecting my mouses position?

So i'm trying to make it so when a player left clicks anywhere on the screen, a brick spawns exactly on where the mouse clicked, It is giving me and error saying that Mouse.X expected a CFrame but a PlayersMouse doesnt have a CFrame action. Could anyone help?

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.Button1Down:connect(function()
    local part = Instance.new('Part')
part.Parent = game.Workspace
part.CFrame = Mouse.X
end)

1 answer

✓ Accepted answer
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.Button1Down:connect(function()
    local part = Instance.new('Part')
part.Parent = game.Workspace

part.CFrame = (Mouse.X,Mouse.Y,Mouse.Z)------You need all three axis's to get the mouse's exact position

end)

3 comments

1

Or just simply do "Mouse.Hit.Positon". :P

0

true

0

Thanks guy's much appreciated!

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