I've been trying to make this work for a long time now but it just does. (Does a push up once and the letters don't change)
for i = 1, 15,1 do Animation = script.Parent.Parent.Parent.PushUps AnimationTrack = plr.Character.Humanoid:LoadAnimation(Animation) AnimationTrack:Play() print("Playing") number = 0 number = math.randomseed(1,4) if number == 1 then key = "x" plr.PlayerGui.FistMaster.PushUps.TextLabel.Text = "X" end if number == 2 then key = "y" plr.PlayerGui.FistMaster.PushUps.TextLabel.Text = "Y" end if number == 3 then key = "k" plr.PlayerGui.FistMaster.PushUps.TextLabel.Text = "K" end if number == 4 then key = "t" plr.PlayerGui.FistMaster.PushUps.TextLabel.Text = "T" end wait(1) plr:GetMouse().KeyDown:connect(function(k) if k == key and pushUpsEnabled == true then presses = presses + 1 print(presses) else presses = 0 end end) end
You can't give us code and magically expect us to know what is going on. You need to explain in detail what is happening and where you think the problem begins.
I don't have an answer to your question but I would like to show you how easy it is to use UserInputService.
local UserInputService = game:GetService("UserInputService") -- Get the UserInputService UserInputService.InputBegan:connect(function(InputObject) -- On input from player call a function with the param InputObject. InputObject is the key the player is pressing. if InputObject.KeyCode == Enum.KeyCode.X then -- if the key that the user pressed was X print(InputObject.KeyCode) -- Print the KeyCode of the key pressed. end end)