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

How and how to fix "this Mouse is not Activate" client bug in tools?

Asked by 6 years ago

This extremely short and easy script cause an error.

local tool = script.Parent

tool.Equipped:connect(function(mouse)
    tool.Activated:connect(function()
        print(mouse.Target)
    end)
end)

At first when the tool was equipped and activated by a player then the functions work correctly as it should.

But when they reequip it and activate it again. The mouse will deactivate itself and cause an error

0
You need to disconnect the event after its unequipped. The mouse passed it the equipped event will disconnect all events for you when the tool is unequipped. User#5423 17 — 6y

1 answer

Log in to vote
0
Answered by
UgOsMiLy 1074 Moderation Voter
6 years ago

Have you tried putting this in a local script:

local tool = script.Parent
local mouse = game.Players.LocalPlayer:GetMouse()

tool.Activated:Connect(function()
    print(mouse.Target)
end)
0
Yes I've tried it. It worked correctly but the question here is how and how to fix without using this solution magicguy78942 238 — 6y
Ad

Answer this question