Hi, I’m making a small naruto game and I’ve got the mode thing made, but i have no idea what I need to do when activating the mode because they’re multiple of them, how do i do so theres like a transformation for each?
Could you hook each of them up to a keybind?
It could look something like this:
local UIS = game:GetService("UserInputService")
if UIS.KeyboardEnabled then
UIS.InputBegan:Connect(function(Input, IsTyping)
if IsTyping then return end
if Input.KeyCode == Enum.KeyCode.Z then
-- activate mode 1
elseif Input.KeyCode == Enum.KeyCode.X then
-- activate mode 2
end
end)
end
you could also then create a function called
local function Mode1On()
-- the script
end
local function Mode1Off()
-- the script
end
then use a bool value to know if you need to switch it on or off. trigger the function depending on this.
the transformation could also be animated, I strongly recommend moon animator.
Isn’t this going to be very messy? Since I’m planning to add many of them.
Perhaps put them in a module script instead? Then you can require it for any player? Only difference would be rather than local functions, you use
function module.{the function name}(character, player)
end
then use character to get the player to manipulate. player is there if you have to get any GUI etc.
then in server script service, make a script that looks something like:
local Modes = require(game:GetService("ServerScriptService"):WaitForChild("{your module name}"))
game.Players.PlayerAdded:Connect(function(p)
p.CharacterAdded:Connect(function(c)
-- the keybind stuff here
end)
end)
this way it is a bit less sloppy.
I can try, I will prob respond here again.