#Scripting

21 messages · Page 1 of 1 (latest)

midnight helm
#

So ik how to make a if key pressed it will do a move but how do i add it on the same someone without copying and pasting the same code and changing the name of the variable

brazen basalt
#

what

sturdy idol
#

elseif

deep idol
#

Can you elaborate further?

brazen basalt
#

what are you

deep idol
#

word

brazen basalt
#

@midnight helm show me what you mean by code

#

since i can't understand what you just said

normal charm
midnight helm
#

this is my code idk how to word my question but i have a move set how do i put it in there without having to paste the same code to use one move

#

cuz when i press R the move works

#

but when i was playhing around trying to fit it where i can use T i cant

normal charm
#

Use table

#

Man Roblox table

#

For example

#
local keyFuncs = {
  R = function()
    print("Hello")
  end,
  T = function()
    print("world")
  end
}

[OnKeyPress](input, gameprocess)
  local str = tostring(input.KeyCode)
  local letter = str:split()[1]
  if not keyFunc[letter] then return end
  keyFunc[letter]()
end
#

Not exactly this but something similar you get the idea

midnight helm
#

so when i do local keyfuncs i put R= "roblox animation ID"

normal charm
#

if you want yes

sturdy idol