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

Enable localscript when equipping tool?

Hi, its me... again

Well, basically, i have a torso follow mouse script, but my playerbase said its uncomfortable and hard to control in mobile. So i wanted to make it just work when equipping a weapon.

However, my script isnt working, although there are no errors.

Here´s the localscript in the tool

And yeah, the scripts are disabled and correctly referenced

local fm = game.Players.LocalPlayer.PlayerGui.FollowMouse
local ls = game.Players.LocalPlayer.PlayerGui.LocalScript


script.Parent.Equipped:Connect(function()
	fm.Disabled = false
	ls.Disabled = false

end)

script.Parent.Unequipped:Connect(function()
	fm.Disabled = true
	ls.Disabled = true


end)

1 answer

Use event connections instead of disabling it. Local scripts run automatically when equipped but they don't if they are disabled.

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