✓ Accepted answer
To do this then you should follow these steps:
1) - Make a table full of all the tools you want the player to have access to
2) - Make a variable for how you'll index the table.
3) - Change the variable according to the WheelForward and WheelBackward Events
4) Replace the tools in the character with the WheelForward and WheelBackward Events, and index the tool table according to the variable.
Should look something like this;
NOTE: This should be a localscript in StarterGui
local tools = {}
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local toolIndex = 1
repeat wait() until plr.Character
local char = plr.Character
function clearTools(c)
for i,v in pairs(c:GetChildren()) do
if v:IsA('Tool') or v:IsA('HopperBin') then
v:Destroy()
end
end
end
function replaceTool(c)
local tool = tools[toolIndex]
if tool then
clearTools(c)
tool:Clone().Parent = c
end
end
mouse.WheelForward:connect(function()
toolIndex = toolIndex + 1
replaceTool(char)
end)
mouse.WheelBackward:connect(function()
toolIndex = toolIndex - 1
replaceTool(char)
end)
1 comment
Awesome idea!