of     1   

UltraSkiMask
#215814303Tuesday, May 02, 2017 10:52 PM GMT

I just got back into scripting, and I completely forgot Keydown doesn't work anymore so I tried UserInputService. HOWEVER, when I did use it my entire script broke and I don't know whats wrong. There are no errors whatsoever, but what broke was the Debounce for the animation, and the damage. I can't seem to figure out what is wrong. Any clues?
UltraSkiMask
#215814362Tuesday, May 02, 2017 10:53 PM GMT

Oh, forgot the script here it is. (By the way I'm not close to finished with this script however, if you have any tips to using UIS let me know.) vital = {v = "UpperTorso","LowerTorso","Head"} local Player = game.Players.LocalPlayer repeat wait() until Player.Character ~= nil and Player:HasAppearanceLoaded() == true and script:FindFirstChild("Animation")~=nil local char = Player.Character local Mouse = Player:GetMouse() local Animations = {script.Animation} enabled = false local function find(x,y) for i,v in pairs(y) do if v == x then return true end end return false end function onKeyPress(inputObject, gameProcessedEvent) if enabled then return elseif inputObject.KeyCode == Enum.KeyCode.E then print("fires") coroutine.wrap(function() local animtrack = char.Humanoid:LoadAnimation(Animations[1]) animtrack:Play() print('test') wait(5) enabled = false end)() local RArm = char:WaitForChild("RightHand") RArm.Touched:connect(function(hit) if enabled and hit.Parent:FindFirstChild("Humanoid") ~= nil and hit.Parent:findFirstChild("Hitby"..char.Name) == nil then local hitty = Instance.new("BoolValue",hit.Parent) hitty.Name = "Hitby"..char.Name game.Debris:AddItem(hitty,1) print("works") if find(hit.Name,vital) then hit.Parent.Humanoid:TakeDamage(20) else hit.Parent.Humanoid:TakeDamage(5) end end end) end end game:GetService("UserInputService").InputBegan:connect(onKeyPress)
UltraSkiMask
#215819031Wednesday, May 03, 2017 12:08 AM GMT

BUMP
caca50
#215819730Wednesday, May 03, 2017 12:20 AM GMT

You want to make sure the second argument is false. Otherwise, this function will fire when you type in the chat and press the specified key.
UltraSkiMask
#215825247Wednesday, May 03, 2017 1:41 AM GMT

Oh I didnt know that thanks.
TheShadowMessage
#215825337Wednesday, May 03, 2017 1:43 AM GMT

pretty sure keydown still works
UltraSkiMask
#215877620Wednesday, May 03, 2017 10:46 PM GMT

In studio it works but in game it doesnt
Gomlsauresrex
#215878003Wednesday, May 03, 2017 10:50 PM GMT

Use ContextActionService local cas=game:GetService("ContextActionService") bind=function(action, state, key) if state==Enum.UserInputState.Begin then --do stuff end end cas:BindAction("keyPress", bind, false, Enum.KeyCode.E)
UltraSkiMask
#215880268Wednesday, May 03, 2017 11:20 PM GMT

Isnt that for mobile? still looking for solutions.
Gomlsauresrex
#215928397Thursday, May 04, 2017 8:27 PM GMT

No its not only for mobile.

    of     1