Backpack Script Disabling

Oh okeh.That makes sense.

Well, think of it like this…
if the pcall is ‘success == true’ then result will be whatever you ‘return’ from inside the pcall
if the pcall is ‘success == false’ then result will hold the error message

bro. u have to first wait for the script to load in the player’s backpack.
then check if it exists , then run the code.

local hamonKickGui = plr:WaitForChild("Backpack"):WaitForChild("HamonKick")

if hamonKickGui then
      -- code here
else 
    return
end

I’ve got a problem, I’m attempting to get the character from the hit, but it’s not working.
The problem is on line 27.

game.ReplicatedStorage.HamonKick.OnServerEvent:Connect(function(Player)
	local char = Player.Character or Player.CharacterAdded:Wait()
	local hum = char:FindFirstChild("Humanoid")
	local Kick = hum:LoadAnimation(script:WaitForChild("Kick"))

	Kick:Play()
	local HitBox = script:WaitForChild("HitBox"):Clone()
	HitBox.CFrame = char:FindFirstChild("Left Leg").CFrame
	HitBox.Parent = char:FindFirstChild("Left Leg")

	local Pweld = Instance.new("Weld")
	Pweld.Part0 = HitBox
	Pweld.Part1 = char:FindFirstChild("Left Leg")
	Pweld.C0 = HitBox.CFrame:inverse() * char:FindFirstChild("Left Leg").CFrame
	Pweld.Parent = Pweld.Part0

	HitBox.Touched:Connect(function(Hit)
	
		if Hit:IsA("Part") or Hit:IsA("MeshPart") then
			if Hit.Parent ~= char then
				local EHumRP = Hit.Parent:FindFirstChild("HumanoidRootPart")
				local Humanoid = Hit.Parent:FindFirstChild("Humanoid")

				if Humanoid then
					HitBox:Destroy()
					if Hit.Parent:FindFirstChild('Left Leg') then
						local enplr = Hit:GetPlayerFromCharacter(Hit.Parent)
					
							local HumanoidRP = Hit.Parent:FindFirstChild("HumanoidRootPart")
							Hit.Parent:FindFirstChild("Humanoid"):TakeDamage(50)
							local vel = Instance.new("BodyVelocity",workspace.HumanoidRP)
							vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
							vel.Velocity = workspace.char.HumanoidRootPart.CFrame.lookVector * 45
							wait(1)
							vel:Destroy()
				
							if Hit.Parent.Humanoid.Health < 1 then
							enplr:Kick("You got kicked by someone who wasted their money...")
                        end
						
					end
				end
			end
		end	
	end)
end)








There are no line numbers, so which is line 27, and is it giving you an error, or not, in other words how do you know the problem is on line 27

Oh, sorry about that. It is erroring, the specific line of code is local enplr = Hit:GetPlayerFromCharacter(Hit.Parent). It’s near the bottom. I know its erroring because of out put. The error says, Unable to get player from character from _. It shows the name of a body part, for example left leg, but is still failing to get the player from it. I don’t have an image, because I am once again outside.

try… enplr = game.Players:GetPlayerFromCharacter(Hit.Parent)

Well, it’s not erroring anymore, but It won’t kick either.
Here is the important piece of code:

if Humanoid then
					HitBox:Destroy()
					if Hit.Parent:FindFirstChild('Right Arm') then
						local enplr = game.Players:GetPlayerFromCharacter(Hit.Parent)



						Hit.Parent:FindFirstChild("Humanoid"):TakeDamage(50)
						local vel = Instance.new("BodyVelocity",EHumRP)
						vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
						vel.Velocity = HumRP.CFrame.lookVector * 70
						wait(1)
						vel:Destroy()
						if Humanoid.Health < 1 then

							enplr:Kick("Someone wasted their money apparently...")
							Player.leaderstats.moneys.Value = Player.leaderstats.moneys.Value + 50

						end
						end

not sure why you are trying to find Right Arm… but where does the code get to, does it ever get to the part of :TakeDamage(50) ? Or not?

also by ‘it wont kick’ do you mean just the pushing of the other character?

Maybe its where you are parenting the BodyVelocity. What is EHumRP? Make sure that is the HumanoidRootPart of the target you want to apply the force to.

It does take damage, and by kick, I mean kick the person that has gotten hit, out of the game.

EHumRP, is used to define the person being hits humanoid root part.

Bumping this real quick. jugemujugemu