Hi I’m trying to make a click part then drag it to the mouse position but after a little bit of time the part that the user moved just moves back how do I fix this?
Grab System (LocalScript in starter Gui):
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local point
local down
local function selectPart()
if mouse.Target and not mouse.Target.Locked then
point = mouse.Target
mouse.TargetFilter = point
down = true
end
end
local function movePart()
if down and point and point.Name == "GamePieces" then
point.Orientation = Vector3.new(0,0,0)
script.SelectionBox.Adornee = point
local posX, posY, posZ = mouse.Hit.X,mouse.Hit.Y +1,mouse.Hit.Z
point.Position = Vector3.new(posX,posY,posZ)
end
end
local function deselectPart()
script.SelectionBox.Adornee = nil
down = false
point = nil
mouse.TargetFilter = nil
end
I’ve tried searching around for solutions but I can’t get any of them to work idk
This is all new to me 
Thanks’
An easy fix would be to do the actual dragging on the server, and the mouse/input detection on the client. Use a remote event or two to start and deselect the part. Since client scripts aren’t always replicated on the server.
I say do the
--part of the movepart function
point.Orientation = Vector3.new(0,0,0)
local posX, posY, posZ = mouse.Hit.X,mouse.Hit.Y +1,mouse.Hit.Z
point.Position = Vector3.new(posX,posY,posZ)
on the server.
Ok so I made a remote event GrabToServer
And in serverscriptservice theres a script called GrabSysServer
GrabSysServer:
game.ReplicatedStorage.GrabToServer.OnServerEvent:Connect(function(player, point, mouse)
point.Orientation = Vector3.new(0,0,0)
local posX, posY, posZ = mouse.Hit.X,mouse.Hit.Y +1,mouse.Hit.Z
point.Position = Vector3.new(posX,posY,posZ)
end)
Function movePart():
local function movePart()
if down and point and point.Name == "GamePieces" then
game.ReplicatedStorage.GrabToServer:FireServer(player, point, mouse)
script.SelectionBox.Adornee = point
end
end
Error:
Orientation is not a valid member of Player "Players.ScrapBlox1"
- Server - GrabSysServer:2
I suggest you read about how remote events actually work.
Here is a piece of code from that article. NOTICE THE PARAMETERS. Player goes first, even if you don’t send the player as a parameter.
(In your case, do not send player as a parameter in the local script.)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEventTest")
-- Create a new part
local function onCreatePart(player, partColor, partPos)
print(player.Name .. " fired the remote event")
local newPart = Instance.new("Part")
newPart.BrickColor = partColor
newPart.Position = partPos
newPart.Parent = workspace
end
-- Call "onCreatePart()" when the client fires the remote event
remoteEvent.OnServerEvent:Connect(onCreatePart)
Ok (You linked Privacy to audio post)
Also I’m not sending player from localscript now that works and now the mouse.Hit does not work

Here’s the error of the mouse.Hit not working
Thank you for the help so far I’ve been stuck on this for a bit
You can’t have mouse on the server. Try sending Mouse.Hit.Position on the client instead.