Yeah, so if I equip my gear it does not detect any clicks at all and does not print “a 1” or “a 2”
Tool.Equipped:Connect(function(Mouse)
print("selected")
print(Mouse)
Mouse.Button1Down:Connect(function()
print("a 1")
if Mouse.Button1Down then
onMouseDown(Mouse)
else
print("FALSE ALARM")
end
end)
Mouse.Button1Up:Connect(function()
print("a 2")
if Mouse.Button1Up then
onMouseUp(Mouse)
else
print("FALSE ALARM")
end
end)
end)
when it prints the mouse it prints “Instance” I believe that means it works but I do not know anymore.
Can’t you just use:
Tool.Activated:Connect(function()
print("Hi")
end)
1 Like
ash7lyn
(ashlyn)
May 11, 2022, 6:34pm
#4
you should be defining the Mouse by game.Players.LocalPlayer:GetMouse(), not in a tool equipped function
1 Like
Dont use mouse.button1down use activated. Activated is fired when the tool is equipped and the player clicks there screen.
1 Like
game.Players.LocalPlayer is for local scripts, and this is a regular script. so unfortunately that would not work
offrun
(Offrun)
May 11, 2022, 7:24pm
#7
Use the Activated event.
Example:
Tool.Activated:Connect(function()
Print("Test")
end)
It’s pretty much mouseclick for tools. More info: Activated Event
I am using Button1Down because once they let go it will fire the Button1Up event
offrun
(Offrun)
May 11, 2022, 7:26pm
#9
Also this is what your script should look like
Tool.Activated:Connect(function()
Print("Mouse")
end)
offrun
(Offrun)
May 11, 2022, 7:26pm
#10
So you are attempting to do so because you want the Button1Up Event?
1 Like
yeah. I honestly do not do a lot of scripting with tools, so I am not sure if there is a better way.
offrun
(Offrun)
May 11, 2022, 7:29pm
#12
You should try to use a local script and a user input service or just a user input service and some way to get the player.
Which a good way would be getting the player from the equipped event
1 Like
Actually, I think a better way of doing it is this:
Tool.Activated:Connect(function()
--code stuff
end)
Tool.Deactivated:Connect(function()
--more code stuff
end)
I believe this may work but I will test it in 10 minutes since I am currently busy
offrun
(Offrun)
May 11, 2022, 7:30pm
#14
Yup or just use the deactivated option
1 Like
offrun
(Offrun)
May 11, 2022, 7:32pm
#15
If you ever need the player in a tool remember you could always get the player character as if the player holds the tool then it will just be in it’s character.
Just some info incase you ever need the player