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

onButton1Down won't fire in tool?

Asked by
funyun 958 Moderation Voter
9 years ago

I'm trying to make a (relatively) simple fully-automatic gun. I won't post the entire code, but this is where something's going wrong:

function onEquipped(mouse)
    print("Check 1") --This works
    mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end

gun.Equipped:connect(onEquipped)

...And above that I have the onButton1Down function...

function onButton1Down(mouse)
    print("Check 2") --This doesn't work
    --...more code
end
0
It is in a local script? XToonLinkX123 580 — 9y
0
Nope. It's a server script. funyun 958 — 9y
0
Put it in a local XToonLinkX123 580 — 9y
0
You're thinking of hopperbins. This is an actual tool. funyun 958 — 9y
View all comments (2 more)
0
Yeah, but the mouse is local XToonLinkX123 580 — 9y
0
I do the test and its working and a test server ;) XToonLinkX123 580 — 9y

1 answer

Log in to vote
2
Answered by 9 years ago

Here your error its you only didnt put your code in a local script, you can't got the mouse in a server script because the mouse is local. For more information on the mouse you can go one wiki here

Ad

Answer this question