#is there any way to have a custom character type

1 messages · Page 1 of 1 (latest)

wide plinth
#
    Humanoid : Humanoid,
    Animator : Animator,
    HumanoidRootPart : BasePart
} & Model

    local HCharacter = assert(Character,"Invalid Character") :: Character 

grand badger
#

wdym exactly

wide plinth
#

Humanoid is not a valid member of Model "Workspace.Player1"
whats happens when i try to set the humanoid

potent zodiac
potent zodiac
#

you can make it a table yeah and if check every single component manually

#

I think there are modules online that do this tho

#

type checking at run time

wide plinth
#

i dont think i fully understand ?

function test(self:BallInstance,Character:Model)
    local Character : Character = Character :: Character
    print(typeof(Character))
    self._holdercharacter = assert(Character,"Invalid Character") :: Character 
    
    self._holdercharacter["Humanoid"] = assert(Character:FindFirstChildWhichIsA("Humanoid") :: Humanoid,"Character with no humanoid ????")
    self._holdercharacter["Animator"] = assert(self._holderhumanoid:WaitForChild("Animator") :: Animator?)
    self._holdercharacter["HumanoidRootPart"] = assert(Character:WaitForChild("HumanoidRootPart") :: BasePart,"HRP not found!")
end