#code not working - literally just going to paste it
79 messages · Page 1 of 1 (latest)
you have two variables set to Punch
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local replicatedStorage = game:GetService("ReplicatedStorage")
local remote = replicatedStorage:WaitForChild("Punch")
local contextActionService = game:GetService("ContextActionService")
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://16011280907"
local punchAnim = animator:LoadAnimation(Anim)
local isPunching = false
local function punchAction()
if isPunching == false then
isPunching = not isPunching
punchAnim:Play()
remote:FireServer()
punch.Stopped:Wait()
isPunching = not isPunching
end
end
contextActionService:BindAction("Punch", punchAction, true, Enum.UserInputType.MouseButton1)
contextActionService:SetPosition("Punch", UDim2.new (0.72, -25, 0.20, -25))
contextActionService:SetTitle("Punch", "Punch")```
yea i fixed here
👍
animator is better than just loading in humanoid btw
bro but there are differenct variables
nvm saw one had caps
ok ok
is anyone here cuz if u are
i have re-wroter my code
because it sucked
local plr = game.Players.LocalPlayer
local chr = plr.Character or plr.CharacterAdded:Wait()
local humanoid = chr:FindFirstChildOfClass("Humanoid")
local animator = humanoid:FindFirstChildOfClass("Animator")
local UIS = game:GetService("UserInputService")
local debounce = false
UIS.InputBegan:Connect(function(Input, IS)
if IS == true then return end
if Input.UserInputType == Enum.UserInputType.MouseButton1 then
if debounce == true then return end
debounce = true
game.ReplicatedStorage.PunchHit:FireServer()
local punchAnim = animator:LoadAnimation(script.PunchAnimation)
**workspace.Dummies.Rig:FindFirstChildOfClass("Humanoid"):FindFirstChildOfClass("Animator"):LoadAnimation(script.PunchAnimation):Play()**
punchAnim:Play()
print("M1")
wait(1)
debounce = false
end
end)
this is now my code
line #16 (double starred) is to test using a DUMMY i had to see if the animation works
however the animation does not apply to my player
and oinly the rig
(keep in mind the animations priority is action)
if you really care that much heres the code inside of studio
but it doesnt say any errors
so overall im going from:
game.Players.LocalPlayer.Character or plr.CharacterAdded:Wait():FindFirstChildOfClass("Humanoid"):FindFirstChildOfClass("Animator"):LoadAnimation(script.PunchAnimation):Play()
** You are now Level 1! **
WITH Action priority
your loading the animation on the dummys animator on line 16
you want it to play on the player?
play it on the player
animatior:LoadAnimation()
``` you already have the players animator
load the animation on the players animatior
?!?!
local punchAnim = animator:LoadAnimation(script.PunchAnimation)
wait im confused lol
am i being dumb
yea you were loading your animation on the dummy instead of the player
so does it work now?
lemme see
nope
local plr = game.Players.LocalPlayer
local chr = plr.Character or plr.CharacterAdded:Wait()
local humanoid = chr:FindFirstChildOfClass("Humanoid")
local animator = humanoid:FindFirstChildOfClass("Animator")
local punchAnim = animator:LoadAnimation(script.PunchAnimation)
punchAnim:Play()
thats the code
player --> character --> humanoid --> animator --> (loading animation onto the animator) --> playing animation
is it because the animation is R6 and my character is R15?
yea
nope lol
they are not the same
they do not have the same joints
are most games r15 or r6?
up to u