I want to make a model move with the mouse but I do not know how I know just to make it take only one part I want it to take the whole model I tried with the primary part of the model more did not work. Please, can someone help me
local player= game.Players.LocalPlayer
local mouse = player:GetMouse()
local point
local down
function clickObject()
if mouse.Target ~= nil and mouse.Target.Name ~= "Baseplate" then
point=mouse.Target
mouse.TargetFilter = point
down=true
end
end
mouse.Button1Down:Connect(clickObject)
function moveMouse()
if down and point then
local posX, posY, posZ = mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z
point.Position = Vector3.new(posX,posY,posZ)
end
end
mouse.Move:Connect(moveMouse)
function mouseDown()
down = false
point = nil
mouse.TargetFilter = nil
end
mouse.Button1Up:Connect(mouseDown)
-- this was the script that I did more, I want to improve it so I do not get only parts, but the whole model
I edited, I stay like this but it did not work
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local ModelPlacing = false
local Picked, PickedsOldParent
Mouse.TargetFilter = game.Workspace.CurrentCamera
function KeyDown()
local Picked = Mouse.Target.Parent --Parent since we are trying with a model.
--At this point you have to find out if Picked is a legit model to move. It may not be something what you want to move. Beware.
PickedsOldParent = Picked.Parent
Picked.Parent = game.Workspace.CurrentCamera
ModelPlacing = true
end
function KeyUp()
if Picked then
Picked.Parent = PickedsOldParent
Picked = nil
--This is where you need to fire a RemoteEvent to make it FE compatible.
end
if ModelPlacing then
ModelPlacing = false
end
end
function MouseMove()
if Picked and ModelPlacing then
--First, let's get position.
local Pos = Mouse.Hit.X,Mouse.Hit.Y,Mouse.Hit.Z
--Then model's rotation in CFrame shape. For that, we need to substract position from CFrame.
local RotCF = Picked.PrimaryPart.CFrame - Picked.PrimaryPart.CFrame.new(Pos)
--Now time to get those together.
Picked:SetPrimaryPartCFrame(CFrame.new() * CFrame.new(Pos))
--Pos was Vector3, with CFrame.new, we turned it to CFrame position. RotCF was already a CFrame without a position.
end
end
Mouse.Button1Down:Connect(KeyDown)
Mouse.Button1Up:Connect(KeyUp)
Mouse.Move:Connect(MouseMove)

5 comments
If you tried, you should post your code.
Post your code, And then I will help you. This is not a request site.
you can try welds
Post your code or you question looks like a request. NOT A REQUEST SITE!
Soon this was the script I did not put before because I had a problem