Part moving with mouse issues

You may be thinking of that how much i write in few seconds right?

Cause i have high wpm speed

I still do not have a solution

bro, all of this for nothing?

303030

1 Like

Yea, thatā€™s what was confusing me. But the other thing is that a lot of parts of the code would error, but I wouldnā€™t want to point all that out. It reminded me of how an AI would generate good looking code, but it wouldnā€™t work.

what is?

3030303030303030303030

Use one of the solutions provided and tell them if it works or not. There is 45 replies of asking questions back and forth, itā€™s like weā€™re getting nowhere.

do I put this in playergui?
3030303030

because I just write the base of a code, the other should also do some work on my code to get the product he wants, right? :slight_smile:

1 Like

Hereā€™s my code, if you want to try that.

yeah, put it in player gui, startplayer, anywhere

just spams ā€œUnable to assign property Position. Vector3 expected, got Vector2ā€

local mousePosition = game:GetService("UserInputService"):GetMouseLocation()
local camera = game.Workspace.CurrentCamera
local ray = camera:ScreenPointToRay(mousePosition.X, mousePosition.Y)
local hit, position = game.Workspace:FindPartOnRay(ray)

-- Check if the ray hit a part
if hit then
  -- Set the target part's position to the position of the hit
  targetPart.Position = position
else
  -- Set the target part's position to the end of the ray
  targetPart.Position = ray.Origin + ray.Direction * 100
end

If you want, you could use the new RunContext property which allows Scripts to run on the client, anywhere. It should be easier to understand for beginners because LocalScripts can only run in certain environments like PlayerGui, Tools (hard to understand for me), ReplicatedFirst, etc.

set it in a normal script

30303030

yeah so nothing is working

3030

what is this drafts tab?
30303030

Could you please try my script? Trying to help you here.

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local part = workspace.Parta

local tracking = false
part.ClickDetector.MouseClick:Connect(function()
	if not tracking then
		tracking = true
	end
end)
mouse.Button1Click:Connect(function()
	if tracking then
		tracking = false
	end
end)

mouse.Move:Connect(function()
	if tracking then
		part.Position = mouse.Hit.Position
	end
end)

And of course say if there are any errors.

are you rewriting the directories or just copy pasting the code i am providing and running it? :confused:

1 Like

Button1Click is not a valid member of PlayerMouse ā€œInstanceā€

Oh, change Button1Click to Button1Down. Could have sworn that event existed, guess not.