Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I make a gear that does something on keypress?

Asked by 7 years ago

For starters, I want to make a gear that increases my walkspeed and health by 30 if I press ' e '. I tried UserInput and Keypress, but failed :(. I want to do more advanced stuff with it on the future like summoning and combining with a monster (RPG).

0
Could you show your script for UserInput? I can't help unless I know what you did wrong. Troidit 253 — 7y
0
local h = script.Parent.Parent function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.R then h.Humanoid.WalkSpeed = 30 h.Humanoid.MaxHealth = 300 end end game:GetService("UserInputService").InputBegan:connect(onKeyPress) xxXTimeXxx 101 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Pretty easy!

you can add this is the code:

01local players = game:GetService("Players")
02local player = players.LocalPlayer
03local mouse = player:GetMouse()
04local tool = [SPECIFY WHERE THE TOOL IS HERE]
05 
06local equipped = false
07 
08tool.Equipped:connect(function()
09    equipped = true
10end)
11 
12tool.Unequipped:connect(function()
13    equipped = false
14end)
15 
View all 22 lines...
0
I modified it to this xxXTimeXxx 101 — 7y
0
local tool = script.Parent local h = tool.Parent if Key:lower() then if Key == "f" then h.Humanoid.MaxHealth = 300 end and put it inside the gear in a local script, but it doesnt work xxXTimeXxx 101 — 7y
Ad

Answer this question