Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make the cloned model stay on mouse position?

Asked by
npott13 23
7 years ago

I've been trying the whole to implement this,

whenever i clicked the button the model is cloned in the mouse position, but how will i be able to make it stay on the mouse position until mouse is click again.


local mouse = game.Players.LocalPlayer:GetMouse() local ply = game.Players.LocalPlayer.Name a = game.ReplicatedStorage.TestModel:clone() script.Parent.MouseButton1Click:connect(function() a.Parent = game.Workspace game.Workspace.TestModel.plyName.Value = game.Players.LocalPlayer.Name a:MakeJoints() mouse.TargetFilter = a a:MoveTo(Vector3.new(mouse.Hit.p.X, mouse.Hit.p.Y + (a:GetExtentsSize().Y / 2), mouse.Hit.p.Z)) a:MoveTo(Vector3.new(mouse.Hit.p.X, mouse.Hit.p.Y, mouse.Hit.p.Z)) target = game.Players.LocalPlayer:GetMouse().Hit print("cloned") end)

Answer this question