i have a error please help me i need it so hard ? [closed]
Asked by
7 years ago Edited 7 years ago
my error is that it say Humanoid is not member of tool,model what i need to do on that
but i want only the humanoid thing cause the other things dont work
006 | local Tool = script.Parent |
007 | local Handle = Tool.Handle |
008 | local Config = Tool:WaitForChild 'Configurations' |
011 | DoubleClickMaxTime = 0.2 , |
012 | LocalDoubleClickMaxTime = 0.2 , |
017 | SlashingStartedAt = 0 , |
018 | LocalSlashingStartedAt = 0 , |
020 | LocalAttackTicket = 0 , |
021 | DestroyOnUnequip = { } |
024 | local GLib = require(Tool:WaitForChild 'GLib' ) |
028 | function Sword:Connect() |
029 | Handle.Touched:connect( function (hit) |
030 | local myPlayer = GLib.GetPlayerFromPart(Tool) |
031 | local character, player, humanoid = GLib.GetCharacterFromPart(hit) |
033 | if myPlayer~ = nil and character~ = nil and humanoid~ = nil and myPlayer~ = player then |
034 | local isTeammate = GLib.IsTeammate(myPlayer, player) |
035 | local myCharacter = myPlayer.Character |
036 | local myHumanoid = myCharacter and myCharacter:FindFirstChild 'Humanoid' |
038 | if (Config.CanTeamkill.Value = = true or isTeammate~ = true ) and (myHumanoid and myHumanoid:IsA 'Humanoid' and myHumanoid.Health > 0 ) and (Config.CanKillWithForceField.Value or myCharacter:FindFirstChild 'ForceField' = = nil ) then |
039 | local doDamage = Config.IdleDamage.Value |
040 | if Sword.State = = 'Slashing' then |
041 | doDamage = Config.SlashDamage.Value |
042 | elseif Sword.State = = 'Lunging' then |
043 | doDamage = Config.LungeDamage.Value |
046 | GLib.TagHumanoid(humanoid, myPlayer, 1 ) |
047 | humanoid:TakeDamage(doDamage) |
053 | function Sword:Attack() |
054 | local myCharacter, myPlayer, myHumanoid = GLib.GetCharacterFromPart(Tool) |
056 | if myHumanoid~ = nil and myHumanoid.Health > 0 then |
057 | if Config.CanKillWithForceField.Value or myCharacter:FindFirstChild 'ForceField' = = nil then |
060 | if Sword.State = = 'Slashing' and now-Sword.SlashingStartedAt < Sword.DoubleClickMaxTime then |
061 | Sword.AttackTicket = Sword.AttackTicket+ 1 |
063 | Sword:Lunge(Sword.AttackTicket) |
064 | elseif Sword.State = = 'Idle' then |
065 | Sword.AttackTicket = Sword.AttackTicket+ 1 |
066 | Sword.SlashingStartedAt = now |
068 | Sword:Slash(Sword.AttackTicket) |
074 | function Sword:LocalAttack() |
075 | local myCharacter, myPlayer, myHumanoid = GLib.GetCharacterFromPart(Tool) |
077 | if myHumanoid~ = nil and myHumanoid.Health > 0 then |
078 | if Config.CanKillWithForceField.Value or myCharacter:FindFirstChild 'ForceField' = = nil then |
081 | if Sword.LocalState = = 'Slashing' and now-Sword.LocalSlashingStartedAt < Sword.LocalDoubleClickMaxTime then |
082 | Sword.LocalAttackTicket = Sword.LocalAttackTicket+ 1 |
084 | Sword:LocalLunge(Sword.LocalAttackTicket) |
085 | elseif Sword.LocalState = = 'Idle' then |
086 | Sword.LocalAttackTicket = Sword.LocalAttackTicket+ 1 |
087 | Sword.LocalSlashingStartedAt = now |
089 | Sword:LocalSlash(Sword.LocalAttackTicket) |
095 | function Sword:Slash(ticket) |
096 | Sword.State = 'Slashing' |
098 | Handle.SlashSound:Play() |
103 | if Sword.AttackTicket = = ticket then |
108 | function Sword:LocalSlash(ticket) |
109 | Sword.LocalState = 'Slashing' |
113 | if Sword.LocalAttackTicket = = ticket then |
114 | Sword.LocalState = 'Idle' |
118 | function Sword:Lunge(ticket) |
119 | Sword.State = 'Lunging' |
121 | Handle.LungeSound:Play() |
124 | local force = Instance.new 'BodyVelocity' |
125 | force.velocity = Vector 3. new( 0 , 10 , 0 ) |
126 | force.maxForce = Vector 3. new( 0 , 4000 , 0 ) |
127 | force.Parent = Tool.Parent.Torso |
128 | Sword.DestroyOnUnequip [ force ] = true |
131 | Tool.Grip = CFrame.new( 0 , 0 , - 1.5 , 0 , - 1 , - 0 , - 1 , 0 , - 0 , 0 , 0 , - 1 ) |
134 | Sword.DestroyOnUnequip [ force ] = nil |
136 | Tool.Grip = CFrame.new( 0 , 0 , - 1.5 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 1 , 0 ) |
141 | function Sword:LocalLunge(ticket) |
142 | Sword.LocalState = 'Lunging' |
148 | Sword.LocalState = 'Idle' |
151 | function Sword:Animate(name) |
152 | local tag = Instance.new 'StringValue' |
153 | tag.Name = 'toolanim' |
158 | function Sword:Unequip() |
159 | for obj in next , Sword.DestroyOnUnequip do |
163 | Sword.DestroyOnUnequip = { } |
165 | Tool.Grip = CFrame.new( 0 , 0 , - 1.5 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 1 , 0 ) |
167 | Sword.LocalState = 'Idle' |