Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i make my punch disable for 2 seconds for my pose script?

I want to make my pose cancel animation with punch script I tried this but its doesn't work

local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()


local key = 'F'

local Taunt = Instance.new("Animation")
Taunt.AnimationId = 'rbxassetid://3666718264' -- other animations 2262820217, 2262813409, 2425154387, 
local taunted = false

UIS.InputBegan:Connect(function(Input, IsTyping)
 if taunted then return end
 if IsTyping then return end
 local KeyPressed = Input.KeyCode
 if KeyPressed == Enum.KeyCode[key] then
  taunted = true
  char.Humanoid.WalkSpeed = 0
  local LoadAnimation = char.Humanoid:LoadAnimation(Taunt)
  LoadAnimation:Play()
  wait(2)
  char.Humanoid.WalkSpeed = 16
  taunted = false
 end
end)

game.StarterPlayer.StarterCharacterScripts.Punch.Disabled = true
wait(2)

3 comments

0

I don't see you enabling it after the 2 seconds, is that missing or am I just blind or stupid?

0

blind

0

idk

1 answer

✓ Accepted answer

Disabling scripts is not a reliable way of getting them to stop executing

Consider using a BindableEvent, a BoolValue, or some other way of getting your scripts to coordinate - the pose script should make sure it's allowed to run before changing poses.

This discussion is preserved as it was. New answers, comments, and votes are closed.