I'm making it that there is a ClickDetector
inside the Baseplate, and that if you click on the baseplate, then a part will appear wherever you click, but it seems to not work and gives me the error - > GetMouse is not a valid member of players.
Here is my script.
local b = script.Parent.Baseplate local plr = game:GetService("Players") local mouse = plr:GetMouse() b.ClickDetector.MouseClick:Connect(function() local part = Instance.new("Part") part.Position = mouse.Position end)
I'm also confused as to how I would put it on the axis of the base plate EDIT
Player
object, not from the Players
service. Also, the property for mouse position is called Hit
. You'll want to place this code in a local script under StarterPlayerScripts
.wait() local plr = game:GetService("Players").LocalPlayer local mouse = plr:GetMouse() local UIS = game:GetService("UserInputService") local function onMouseDown(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then local part = Instance.new("Part") part.Position = mouse.Hit.p part.Parent = workspace end end UIS.InputBegan:Connect(onMouseDown)
GetMouse is not a valid function of the players service, but it is for the client. Also, the position for the mouse is Mouse.Hit.p
local b = script.Parent.Baseplate local plr = game:GetService("Players").LocalPlayer local mouse = plr:GetMouse() b.ClickDetector.MouseClick:Connect(function() local part = Instance.new("Part") part.Position = mouse.Hit.p end)