#how do i turn this into a keybind
1 messages · Page 1 of 1 (latest)
Use userinputservice
Ngl I forget the exact syntax so look at the docs
But userinputservice is the way to go
👍
The syntax is the way or writing it
user userinputservice.OnKeyPressed:Connect()
and then you can get the key, compare enum.key to the enum.key.yourkeybind
Yea
are u able to type this for me rq
i dont know what u mean, i just started coiding'
Coding
nobody writes script here
Yea
we just fix scripts
u should learn it
watch some videos about userinputservice
i tried many ways
Read documentation
wdym u dont know how
show me your ways
** You are now Level 21! **
i'll tell u whats wrong
okay well
i did this
if input.KeyCode == Enum.KeyCode.Z then
script.Event:FireServer()
if db == false then
db = true
wait(.1)
wait(cd)
db = false
end
end)
the red lines arent telling me anything'
** You are now Level 1! **
so would i put this in it or before it
user userinputservice.OnKeyPressed:Connect()
?
Yea
what did u delete
how could i put it in
parameters
wait did you give the script to know what the input is
i gave the script cuz i wanna make it so it activates when the key is pressed while the tool is equipped
but im not working it out
you need to decalre uis
so like this? UserInputService.Inputbegan.OnKeyPressed:Connect()
if input.KeyCode == Enum.KeyCode.Z then
script.Event:FireServer()
if db == false then
db = true
wait(.1)
wait(cd)
db = false
end
end)
character:Findfirstchild("TOOLNAME")? it will say when the tool is equipped because it connectes to the characters right @fallen ermine or am i wrong
where would i put that
this is so confusing, watching tutorials and shi and still aint getting nothing
After Userinputservice, there can only be an event
not "events"
oh
well
im trying to do everything and it still doesnt work
im so confused
cuz right now
when the tool is clicked
it works
but i wanna turn that into a keybind
can you show your FULL code
??
i feel like you skipped some things
local db = false
local cd = 1
script.Parent.Activated:Connect(function()
if db == false then
db = true
script.Event:FireServer()
wait(.1)
wait(cd)
db = false
end
end)
this is the full script when clicked
but im tryna turn into when KEY is clicked, it activates the rest
thats what im having trouble with
where would i find this for tools?
why are you so focused on tools? you just need a check to see if the tool is active
** You are now Level 2! **
tool.activated -> turns a variable true
tool.deactivated -> turns the variable false
pressing the key -> check if the variable is true, then run it
you need to do UIS, its ANY user keyboard input
its because im tryna make a one piece blox fruit type system
like
when press Z this skill used
oh ok
look bruh not trying to demotivate you but if you can't even handle userinputservice to capture a keypress, you sure as heck aint making no bloxfruit clone, far less even a generic battlegrounds game. yes i know how badly everyone wants one of their own, but it aint happening. sorry. you need to get better at coding first. don't start with your dream game. start with something simpler.
like for example, since you just started coding, make a jumping simulator, or a button simulator, or a dropper tycoon. all of these things will give you the start you need to eventually (years from now) have the skills to make a battlegrounds game