#Character is not a valid member of Model "Workspace.Rig"

1 messages · Page 1 of 1 (latest)

hoary salmon
#

How can I fix this?

local char = plr.Character

plr:

local plr = script.Parent
brave totem
brave totem
#

so the problem is that there is no object name Character in the rig model

hoary salmon
#

no object named character?

brave totem
#

yes, player.Character only works if player is a player object, which in this case isnt, its a model

#

in this case it is looking for an object named Character

#

which it cant find, so it gives an error

hoary salmon
#

ohh okay

#

what should i do then? cause im trying to make it parry infinitely

brave totem
#

you already have the model of the rig using script.Parent, you dont need to do anything else

#

or is there something else you're trying to do?

hoary salmon
#

lemme give you the whole script

#
local AttributeRF = game.ReplicatedStorage.StateManager:FindFirstChild("SetAttributeRF")
local stateManager = require(game.ReplicatedStorage.StateManager)
local parryDuration = 1

local plr = script.Parent

while(true) do
    print("Rig Parry")
    
    stateManager.SetState(plr, "Parrying", true, parryDuration)

    local char = plr.Character
    local hum = char:WaitForChild("Humanoid")
    local animator = hum:WaitForChild("Animator")

    local parryAnim = game.ReplicatedStorage.Animations:FindFirstChild("Parry")
    local parryTrack = animator:LoadAnimation(parryAnim)
    local parryDuration = 1

    parryTrack:Play()

    parryTrack:GetMarkerReachedSignal("Pause"):Connect(function()
        parryTrack:AdjustSpeed(0)
    end)

    task.wait(1)

    parryTrack:Stop()

    task.wait(parryDuration)
end
#

so its running on a while loop

#

in the loop it grabs the character and humanoid to make an animator

#

actually i should put those out of the while loop but ill do that later

#

and im setting a parry state so it can be detected if its parrying in other scripts

brave totem
#

just change

local char = plr.Character

to

local char = script.Parent
hoary salmon
#

oh okay

brave totem
#

again your character in this case is just script.Parent

hoary salmon
#

OHH cause i legit forgot that player is the person putting in the inputs and character is just the model

#

yeah