To expand, i created a tool that when you press it, it will fire an animation and make the other player take damage.
It says the players left leg is not a valid member of the character.
Here's the Local Script
local Animation = script.Animation local Replicated = game:GetService("ReplicatedStorage") local RemoteEvent = Replicated.Remotes.Punch local Debounce = false wait(2) local Humanoid = game.Players.LocalPlayer.Character.Humanoid script.Parent.Activated:Connect(function() if not Debounce then Debounce = true local AnimationTrack = Humanoid:LoadAnimation(Animation) RemoteEvent:FireServer() wait(2) Debounce = false end end)
Here's the server script:
local Tools = game:GetService("ReplicatedStorage"):WaitForChild("Tools") local RemoteEvent = game:GetService("ReplicatedStorage").Remotes.Punch local Animation = Tools.SuperPunch.PunchConnecter.Animation wait(1) RemoteEvent.OnServerEvent:Connect(function(player) local Hum = player.Character.Humanoid local AnimationTrack = Hum:LoadAnimation(Animation) AnimationTrack:Play() print("Hello!") if AnimationTrack.IsPlaying then local LeftArm = player.Character["Left Arm"] LeftArm.Touched:Connect(function() Hum:TakeDamage(10) print("Damaged another player!") end) end end
Hello!
This might be because your game is r15 and not r6. In r15, Left Arm does not exist - there is Left Lower arm and Left Upper Arm. In r6, it does. That is probably why there is an error when you try to find it. There are two methods to fix it.
In order to change your game to r6, in studio at the top of the screen press "home" and then find the cog/gear/settings icon called game settings and click it. Then, when the game settings window pops up, click avatar and then r6. Save your settings and you should be good to go.
Note that if your animations are r15, you should do these instructions below to make your script r15 compatible. Change player.Character["Left Arm"]
to player.Character["LeftHand"]
. If this hitbox is too small, consider creating a transparent part and welding it to the arm and using that for collision detection instead.
If you have any questions or if anything doesn't work feel free to comment or ask for my discord. I hope this helps you! :D
-ProqrammedGreen
Perhaps you have to make your character R6. R15 characters don't have a body part called Left Arm
.