This script is supposed to make a part follow the mouse while it is held down but then go stationary when lifted why does it not do this? It prints Lift and press.
mouse = game.Players.LocalPlayer:GetMouse() tool = script.Parent spawned = false final = false function DownClick() print ("Press") if spawned == false then local target = mouse.Target q = game.Lighting.Beacon:Clone() q.Parent = game.Workspace q.Owner.Value = script.Parent.Parent.Name q.Size = Vector3.new(3,3,3) q.Anchored = false q.CanCollide = false spawned = true print ("Checkpoint 1; passed") while spawned do wait() q.Position = CFrame.new(Vector3.new(tool.Parent.Humanoid.TargetPoint.X,1,tool.Parent.Humanoid.TargetPoint.Z)) end end end mouse.Button1Down:connect(DownClick) function UpClick() print ("Lift") final = true q:findFirstChild("Ready") = true q.Anchored = true end mouse.Button1Up:connect(UpClick) function onUnequipped() q:remove() spawned, final = false, false end script.Parent.Unequipped:connect(onUnequipped)
Output:
EDIT
15:54:43.768 - Players.Player1.Backpack.Test2.BeaconCreate:20: bad argument #3 to 'Position' (Vector3 expected, got CFrame)
q:findFirstChild("Ready") = true
Should be
q:findFirstChild("Ready").Value = true
You're trying to set an object to true, which is illegal. You can set the value tho.
If this work, please vote up :)