I'm trying to get one of my models to be cloned, turn a little transparent and then move with the mouse when I click on a button. I've made it so it is cloned and moves with the mouse but It breaks apart and they all try to put themselves where the mouse.target is. I want them to retain their model form and also I when I click I want the model to appear and the transparent clone is destroyed or even placed then the transparency is changed.
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
function Click ()
local B = game.ReplicatedStorage.Headquarters
local clone = B:Clone()
clone:Clone().Parent = game.workspace.Buildings
print "Cloned"
local part = workspace.Buildings.Headquarters
for i,child in pairs (part:GetChildren())do
mouse.Move:connect(function()
if mouse.target then
if mouse.target~=part then
child.Position = Vector3.new(mouse.hit.p.X,mouse.hit.p.Y,mouse.hit.p.Z)
child.Transparency = .5
mouse.Button1Up:connect(function()
child.Position = (mouse.UnitRay)
end)
end
end
end)
end
end
workspace.Outline.ClickDetector.MouseClick:connect (Click)
Any Help will be Appreciated! Thank you.
