#code not working - literally just going to paste it

79 messages · Page 1 of 1 (latest)

tribal swan
#

i am NEW and this is my first project ever

shrewd burrow
#

dude

#

use animator

mild escarp
#

you have two variables set to Punch

shrewd burrow
#
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

mild escarp
#

👍

shrewd burrow
#

animator is better than just loading in humanoid btw

shrewd burrow
mild escarp
#

nvm saw one had caps

tribal swan
#

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()

opal shellBOT
#

studio** You are now Level 1! **studio

tribal swan
#

WITH Action priority

mild escarp
#

your loading the animation on the dummys animator on line 16

tribal swan
#

yes

#

that is what i said

mild escarp
#

you want it to play on the player?

tribal swan
#

yes

#

it doesn't show up

mild escarp
#

play it on the player

tribal swan
#

i am?

#

line #17 punchAnim:Play()

mild escarp
#
animatior:LoadAnimation()
``` you already have the players animator
#

load the animation on the players animatior

tribal swan
#

?!?!

#

local punchAnim = animator:LoadAnimation(script.PunchAnimation)

#

wait im confused lol

#

am i being dumb

mild escarp
#

yea you were loading your animation on the dummy instead of the player

tribal swan
#

nono

#

i deleted that

#

i was using that as a test

mild escarp
#

so does it work now?

tribal swan
#

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?

mild escarp
#

yea

tribal swan
#

oh lol

#

that makes sense

#

i thought r6 works on r15s

mild escarp
#

nope lol

tribal swan
#

😭

#

so its either an r15 game or an r6 game?

mild escarp
#

in game settings --> Avatar you can change it r6

#

YEA

#

R6 or R15

tribal swan
#

thats actually so dumb

#

why cant r6 work on r15

mild escarp
#

r6 has six joints

#

r15 has 15

tribal swan
#

ik how it works

#

just like

mild escarp
#

they are not the same

tribal swan
#

you'd think r6 would work on r15

#

since they have the same 6 joins + 9 more

mild escarp
#

they do not have the same joints

tribal swan
#

are most games r15 or r6?

mild escarp
#

r15

#

r6 is used for obbies

tribal swan
#

should i make mine r15 then/

#

ok

mild escarp
#

up to u

tribal swan
#

alr then

#

im making it r15