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

when ever i clicked on the screen it wont go to the position of the mouse?

Asked by 4 years ago

local Player = game.Players.LocalPlayer local mouse = Player:GetMouse() local Part = game.Workspace.Baseplate

mouse.Button1Down:Connect(function(clicked) if clicked then Part.Position = Vector3.new(mouse.x,mouse.y,0)

end

end)

0
remove clicked there is no parameter from Mouse.Button1Down Mr_m12Ck53 105 — 4y

1 answer

Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
4 years ago
local Player = game:GetService("Players").LocalPlayer
local Cursor = Player:GetMouse()

local Part = workspace.Part

Cursor.Button1Down:Connect(function()
    if (Cursor.Target ~= nil) then
        Part.Position = Cursor.Hit.p
    end
end)
Ad

Answer this question