I would like a Dragger to move a model, but It doesn't work.
Here is my script:
local Dragger = Instance.new("Dragger")
local MouseDown = false
local plr = game.Players.LocalPlayer
script.Parent.Equipped:connect(function()
local Mouse = plr:GetMouse()
if not Mouse then return end
Mouse.Button1Down:connect(function()
print("Down")
Instance.new("SelectionBox",game.Players.LocalPlayer.PlayerGui).Adornee = Mouse.Target
print("Selected")
if Mouse.Target.Locked == true then MouseDown = false print("Locked") return end
print("Brick")
if Mouse.Target.Parent:IsA("Model") then
MouseDown = true
local list = Mouse.Target.Parent:GetChildren()
Dragger:MouseDown(Mouse.Target,Mouse.Target.Position - Mouse.Hit.p,list)
else
MouseDown = true
Dragger:MouseDown(Mouse.Target,Mouse.Target.Position - Mouse.Hit.p,{Mouse.Target})
end
end)
Mouse.Move:connect(function()
if MouseDown == true then
Dragger:MouseMove(Mouse.UnitRay)
end
end)
Mouse.Button1Up:connect(function()
if MouseDown == true then
MouseDown = false
for _, selec in pairs(plr.PlayerGui:GetChildren()) do
if selec:IsA("SelectionBox") then
selec:Destroy()
end
end
Dragger:MouseUp()
end
end)
Mouse.KeyDown:connect(function(Key)
if MouseDown == true then
if Key == "r" then
Dragger:AxisRotate("Y")
elseif Key == "t" then
Dragger:AxisRotate("X")
end
end
end)
end)
I made a list with :GetChildren() but it doesn't work and it says Mouse part should be in list I tried to write this line:
Dragger:MouseDown(Mouse.Target.Parent,Mouse.Target.Position - Mouse.Hit.p,{Mouse.Target.Parent})
Not working too.
Thanks if you could help me.
