How do I make a tool with two states/models?

Hey guys forgive my ignorance in advance, I have almost no knowledge in scripting and am pretty new to Roblox studio.

What I’m trying to do is make a tool with two models; one when equipped like normal (which I already figured out) and one when clicking with the tool equipped, which changes the tool to the second model. Basically if you’ve played deepwoken, like the encyclopedia from that game.

If anyone could tell me how I could structure or do this I would be grateful, thanks.

Here is my badly drawn diagram if you’re still confused lol (Ignore the other things that are part of it like the gui and sound)

1 Like

If you want the tool to change model when clicked, you can try doing it like this:

Tool.Activated:Connect(function() -- connect function to Tool.Activated event
	-- Set the handle's MeshID or something
end)

Source: How to make something happen when you click on screen on a tool - #2 by Hello42bacon

2 Likes

If the tool has 2 modes you would have to store the current mode as a value.

So either active or inactive, active meaning the book is out inactive meaning it isn’t

Using UserInputService detect when the player clicks left mouse button and if the tool is equipped, which will be a bool value just either true or false you check if the tool value is active, if so set it to inactive and hide the book, otherwise if its inactive, set the value to active and display the book.

For displaying the book you can do it in many different ways and I never played deepwoken but I can predict is probably just a UI which you can set to being visible

1 Like

Hey thanks for the replies

Okay so I’m pretty sure I’ve figured out the boolean value and userinputservice already, but what I’m confused on is how I should display the second model of the book. I don’t particularly know where to store the open book model. I have the function for it to become visible on tool click (the boolean value on userinputservice as said), but since it isn’t part of the handle or anything the open book model will appear in the workspace and kind of just fall out of existence.

1 Like

Is the book a model or a mesh.

1 Like

The hardest part of this would be animating the arms as shown in the second picture.
Other than that, simply swap models between the closed and open versions of the tool.
Two tools one closed one open all part of the same tool.

Could even go one step more and make an accessory of the book on your belt - when not in use.

In fact you could use transparency for the swap … very raw script here.

local tool = script.Parent
local closedBook = tool:WaitForChild("ClosedBook")
local openBook = tool:WaitForChild("OpenBook")
local isBookOpen = false

tool.Activated:Connect(function()
    if isBookOpen then
        closedBook.Transparency = 0
        openBook.Transparency = 1
    else
        closedBook.Transparency = 1
        openBook.Transparency = 0
    end
    isBookOpen = not isBookOpen
end)

Both books are there only one is not transparent.

OR you could look at how a open and close door works in the toolbox
and convert that to a book dong the same as a tool.

Both ways would be interesting to try.

The book is two separate models, one for the closed book, and one for the open one.

Alright, I kinda understand what you’re saying. I’ll try both thanks.

In this case the first version of my post should be easy to pull off … gl.