Hi,

I have a script in the ServerScriptService:

local re= game.ReplicatedStorage:WaitForChild('RemoteEvent')

re.OnServerEvent:connect(function(plr,reason,target,pos)
	if reason == 'Drag' then
		target.CFrame= CFrame.new(pos)
	end
	end)

Also, a LocalScript in the StarterGUI

local re= game.ReplicatedStorage:WaitForChild('RemoteEvent')
local player= game.Players.LocalPlayer
local mouse= player:GetMouse()
local target, drag 



mouse.Move:connect(function()

	if target and drag then
		re:FireServer('Drag',target,mouse.Hit.p)
	end
end)



mouse.Button1Down:connect(function()
	if mouse.Target then
	drag= true
	target= mouse.Target
	end
end)

mouse.Button1Up:connect(function()
	drag= false
	target= nil
	mouse.TargetFilter= nil
end)

My question is, how would I amend these scripts to target specific parts?

Do I need to set a new script in the part or, maybe, can I add a new variable to the StarterGUI script? I would like the RemoteEvent to trigger many different part individually, so I was thinking about putting the "draggable parts" in a folder in the Workspace.

Thank you for your help!

1 comment

0

It is a bit sad no one helped you after 7 months.