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

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

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.

3 comments

0

Are you asking what would stop the m.Button1Down:connect(function() end) ???

0

I'm asking what would end the .RenderStepped function - that would be put in the Button1Down function

0

I posted an answer.

1 answer

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

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