Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Object expands on dragging -why?

here is my code

local Fruittilium = game.Workspace.Fruittilium
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local down = false
Mouse.Button1Down:connect(function()
    down = true
    if Mouse.Target == Fruittilium then
    local Fruit = Fruittilium:Clone()
    Fruit.Parent = game.Workspace
    Fruit.Name = "ACOFruit"
    Fruit.Anchored = true
 while true do
	Fruit.Position = Vector3.new(Mouse.hit.p.x, Mouse.hit.p.y, Mouse.hit.p.z)
    if down == false then
	Fruit:Destroy()
	break
end
    wait(.01)
	end
    else print(Mouse.hit.p)
end
end)
Mouse.Button1Up:connect(function()
	down = false
end)

whenever I clicked on the fruit I would be able to drag a copy of it... the problem is that the clone of the fruit is expanding an then pops..... like a balloon and every time I move it, it reverts to its original size... only to expand and pop again

1 answer

✓ Accepted answer

It's actually not expanding. Rather, it's moving closer and closer to your camera until it goes behind it (what you see as popping).

A simple fix is to set Mouse.TargetFilter = Fruittilium after you check if Mouse.Target == Fruittilium. Then, after the while loop finishes, reset it to Mouse.TargetFilter = nil.

This discussion is preserved as it was. New answers, comments, and votes are closed.