FireClient: player argument must be a Player object?
Error Is On Line 171,
FireClient: player argument must be a Player object
Script 'Players.Jomeliter.Backpack.Punch.Server', Line 171
The Idle animation is constantly playing and doesn't stop!?
Server Script
001 | local Tool = script.Parent |
002 | local Remote = Tool:WaitForChild( "Remote" ) |
003 | local Handle = Tool:WaitForChild( "Handle" ) |
004 | local Mesh = Handle:WaitForChild( "Mesh" ) |
008 | local Equipping = false |
012 | local StraightGripPos = Vector 3. new( 0 , 0 , 1.5 ) |
014 | local BentGripPos = Vector 3. new( 0 , 0.6 , 0.5 ) |
017 | local AttackAble = true |
018 | local AttackRestTime = 1 |
019 | local AttackDamage = 15 |
020 | local AttackVictims = { } |
021 | local AttackWindow = 0.66 |
022 | local AttackDamaging = false |
023 | local AttackWindup = 0.1 |
027 | Mesh.MeshId = StraightMeshData |
030 | Mesh.MeshId = BentMeshData |
037 | local char = Tool.Parent |
038 | return game:GetService( "Players" ):GetPlayerFromCharacter(char) |
041 | function contains(t, v) |
042 | for _, val in pairs (t) do |
050 | function tagHuman(human) |
051 | local tag = Instance.new( "ObjectValue" ) |
052 | tag.Value = getPlayer() |
055 | game:GetService( "Debris" ):AddItem(tag) |
058 | function convertGrip() |
059 | if Tool.Parent and Tool.Parent:FindFirstChild( "Right Arm" ) then |
060 | local weld = Tool.Parent [ "Right Arm" ] :FindFirstChild( "RightGrip" ) |
062 | Grip = Instance.new( "Motor6D" ) |
063 | Grip.Name = "RightGrip" |
064 | Grip.Part 0 = weld.Part 0 |
065 | Grip.Part 1 = weld.Part 1 |
068 | Grip.Parent = weld.Parent |
075 | if not AttackAble then return end |
079 | delay(AttackRestTime, function () |
084 | delay(AttackWindup, function () |
086 | AttackDamaging = true |
087 | delay(AttackWindow, function () |
088 | AttackDamaging = false |
093 | Handle.Swing.Pitch = math.random( 90 , 110 )/ 100 |
096 | Handle.Hit.Volume = 0 |
101 | delay( 0.66 , function () |
104 | local t = math.random( 1 , 2 ) |
106 | Remote:FireClient(getPlayer(), "PlayAnimation" , "Swing1" ) |
108 | Remote:FireClient(getPlayer(), "PlayAnimation" , "Swing2" ) |
110 | Remote:FireClient(getPlayer(), "PlayAnimation" , "Idle" ) |
116 | local wielder = Tool.Parent |
117 | if wielder and wielder:FindFirstChild( "HumanoidRootPart" ) and char and char:FindFirstChild( "HumanoidRootPart" ) then |
118 | local shover = wielder.HumanoidRootPart |
119 | local shovee = char.HumanoidRootPart |
122 | local duration = 0.15 |
123 | local speed = distance/duration |
125 | local velocity = (shovee.Position - shover.Position).unit * speed |
127 | local shoveForce = Instance.new( "BodyVelocity" ) |
128 | shoveForce.maxForce = Vector 3. new( 1 e 9 , 1 e 9 , 1 e 9 ) |
129 | shoveForce.velocity = velocity |
130 | shoveForce.Parent = shovee |
131 | game:GetService( "Debris" ):AddItem(shoveForce, duration) |
133 | Handle.Hit.Volume = 0.5 |
137 | function onHandleTouched(part,hit) |
138 | if not AttackDamaging then return end |
139 | if part:IsDescendantOf(Tool.Parent) then return end |
141 | if part.Parent and part.Parent:FindFirstChild( "Humanoid" ) then |
142 | local human = part.Parent.Humanoid |
143 | if not contains(AttackVictims, human) then |
144 | table.insert(AttackVictims, human) |
146 | human:TakeDamage(script.Dmg.Value) |
147 | print (script.Dmg.Value) |
154 | if Equipping then return end |
160 | Remote:FireClient(getPlayer(), "PlayAnimation" , "Idle" ) |
171 | Remote:FireClient(getPlayer(), "StopAnimation" , "Idle" ) |
175 | function onRemote(player, func, ...) |
176 | if player ~ = getPlayer() then return end |
178 | if func = = "NormalStart" then |
183 | Tool.Equipped:connect(onEquip) |
184 | Tool.Unequipped:connect(onUnequip) |
185 | Remote.OnServerEvent:connect(onRemote) |
186 | Handle.Touched:connect(onHandleTouched) |