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

Is it possible to make a force a tool to be equipped at all times?

Asked by 6 years ago

I have a tool, and next time I make a game im probably just gonna script my own tool.

But anyways I dont want the player to be able to unequip the tool, I was thinknig of a couple of ways to do this but I still figured id ask here.

So the first way I thought I could do this was to create a loop like this

script.Parent.Unequipped:Connect(function()
    script.Parent.Parent:WaitForChild("Humanoid"):EquipTool(script.Parent)
end)

So that would loop basically when you unequip it forces you to re equip

Another way I thought was maybe disabling the Core Gui for the tool bar so that may work I havent tried it.

But those are my 2 ideas does anyone else have any other ideas? If you know of a tutorial or a wiki page that may help that would be great :)

Thank you for your time :)

1 answer

Log in to vote
0
Answered by 6 years ago

Though I currently cannot offer code for doing so, it might be easier if instead you simply welded the handle of the tool to the player's hand (if your tool has a model) and then used ContextActionService or UserInputService to check when a player clicks on something.

Any kind of key/mouse detection will be handled by a LocalScript. You'd use a remoteEvent to send the location of whatever the mouse was pointing at to a regular Script if you needed the tool to shoot bullets or something.

Hope this helped. If you'd like to know more about how you could go about doing this, don't be afraid to message me explaining a little more detail about what your project is and how you need it to work!

Ad

Answer this question