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

How do I check if a player is holding a tool and select tools for them?

Asked by
P100D 590 Moderation Voter
9 years ago

I want to make a player unable to not have a tool selected. Is there a way for me to check whether they have a tool selected and/or force select a tool for them?

1 answer

Log in to vote
0
Answered by
obcdino 113
9 years ago

If I'm hearing you correctly, you want to check if a tool is selected?

There is a Selected event for tools. You can add it to your connection lines for functions. For example:

tool.Selected:connect(function()
-- 'tool' is just a variable I came up with. Don't use the variable 'tool' if it's not stated.

The following is like any ordinary connection line, and this one checks if the tool is selected.

On activation (clicking with a tool)

Somewhat similar to the Selected event, this checks if a tool was clicked, not selected.

Also can be added to connection lines. For example:

tool.Selected:connect(function()
-- 'tool' is just a variable I came up with. Don't use the variable 'tool' if it's not stated.

Please upvote and accept my answer! Thanks!

0
Great, thanks. Is there a way to force select a tool for a player? P100D 590 — 9y
Ad

Answer this question