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

How can I end the function causing the part to follow my mouse?

Asked by 7 years ago

I can't think of a solution to stopping this:

local plr = game.Players.LocalPlayer
local m = plr:GetMouse()

game:GetService("RunService").RenderStepped:connect(function()
    local bob = workspace.Bob
    if bob then
        bob.Position = m.Hit.p
        m.TargetFilter = bob

        m.Button1Down:connect(function()
            --?? What would stop the above
        end)
    end
end)

I tried changing the conditions to the "if bob then" for a loop but that did nothing.

0
Are you asking what would stop the m.Button1Down:connect(function() end) ??? AstrealDev 728 — 7y
0
I'm asking what would end the .RenderStepped function - that would be put in the Button1Down function WillContinues 20 — 7y
0
I posted an answer. AstrealDev 728 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

It's a better idea to use BindToRenderStep and UnbindFromRenderStep. You can get more information on these functions here.

Ad

Answer this question