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

Enable localscript when equipping tool?

Asked by 3 years ago

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

Log in to vote
0
Answered by 3 years ago

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

Ad

Answer this question