How would i end this propely?

How would i end this script propely? I copy and pasted this script from one of my other scripts and it ended perfectly fine.

However, when i copy and paste it onto this script, it doesn’t work (both scripts are local)

Player.Character["Right Leg"].Touched:connect(function(hit)
	if Kick == false then return end
	if hit.Parent:FindFirstChild("Humanoid") then

		Kick = false
	end

	if hit.Name ~= "TPS" then return end
	local force = Player.Character["Right Leg"].CFrame.lookVector * 35
	local angle = Vector3.new(90000000000,100000,90000000000)

	Kick = false
	TM.ApplyForce(hit, angle, force, "Right Leg")
end)

Player.Character["Right Leg"].Touched:connect(function(hit)
	if Kick == false then return end
	if hit.Parent:FindFirstChild("Humanoid") then
		
		local Player = game.Players.LocalPlayer
		local InputService = game:GetService("UserInputService")

		InputService.InputBegan:Connect(function(Input, Processed)
		if workspace.Configuration.Diving.Value == false then return end
		if not Processed then
		
		Player.Character:WaitForChild("Humanoid").PlatformStand = true
		Player.Character.Torso.RotVelocity = Vector3.new()
		Player.Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
		wait(1)
		Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
		Player.Character.Humanoid.PlatformStand = false
		Player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
		
	
			end
		end
	end)
		
		Kick = false

		Player.PlayerGui.FoulGui.TextLabel.Visible = true
		wait (2)
		Player.PlayerGui.FoulGui.TextLabel.Visible = false
	

if hit.Name ~= "TPS" then return end
				
		
Player.Character:WaitForChild("Humanoid").PlatformStand = true
Player.Character.Torso.RotVelocity = Vector3.new()
Player.Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
wait(1)
Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
Player.Character.Humanoid.PlatformStand = false
Player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
end
	local force = Player.Character["Left Leg"].CFrame.lookVector * 35
	local angle = Vector3.new(90000000000,100000,90000000000)

	Kick = false
	TM.ApplyForce(hit, angle, force, "Left Leg")
	wait (5)
	Kick = true

end)
1 Like

Umm wts wrong with the script?

1 Like

it just errors when i put “end”

After if not processed type end

1 Like

if not Processed then
Here u forgot end add end

1 Like

i tried that earlier and it didnt work.

if not processed then return end

1 Like

It doesn’t work. I have lines of code under this that are not underlined red.

Player.Character["Right Leg"].Touched:connect(function(hit)
	if Kick == false then return end
	if hit.Parent:FindFirstChild("Humanoid") then
		
		local Player = game.Players.LocalPlayer
		local InputService = game:GetService("UserInputService")

		InputService.InputBegan:Connect(function(Input, Processed)
		if workspace.Configuration.Diving.Value == false then return end
		if not Processed then 
		
		Player.Character:WaitForChild("Humanoid").PlatformStand = true
		Player.Character.Torso.RotVelocity = Vector3.new()
		Player.Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
		wait(1)
		Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
		Player.Character.Humanoid.PlatformStand = false
		Player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
		
			end
		end
		end)

		
		Kick = false

		Player.PlayerGui.FoulGui.TextLabel.Visible = true
		wait (2)
		Player.PlayerGui.FoulGui.TextLabel.Visible = false
	

if hit.Name ~= "TPS" then return end
				
		
Player.Character:WaitForChild("Humanoid").PlatformStand = true
Player.Character.Torso.RotVelocity = Vector3.new()
Player.Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
wait(1)
Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
Player.Character.Humanoid.PlatformStand = false
Player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
end
	local force = Player.Character["Left Leg"].CFrame.lookVector * 35
	local angle = Vector3.new(90000000000,100000,90000000000)

	Kick = false
	TM.ApplyForce(hit, angle, force, "Left Leg")
	wait (5)
	Kick = true

end)

function CloseEnoughToABall()
	--[[
		unfortunately you dont use
		collectionservice to track the balls or anything in general, so i have to use
		more inefficient method.
	--]]
	local Character = Player.Character
	if not Character then return end
	local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
	if not HumanoidRootPart then return end
	local CharacterPosition = HumanoidRootPart.Position

	-- DFC stands for distance from character
	local ClosestBall
	local ClosestBallDFC

	local Children = workspace:GetChildren()
	for _, Child in pairs(Children) do
		if Child.Name == "TPS" then
			local DescendantPosition = Child.Position
			if ClosestBall and ClosestBallDFC then
				local DistanceFromCharacter = (CharacterPosition - DescendantPosition).Magnitude
				if DistanceFromCharacter < ClosestBallDFC then
					ClosestBall = Child
					ClosestBallDFC = DistanceFromCharacter
				end
			else
				local DistanceFromCharacter = (CharacterPosition - DescendantPosition).Magnitude
				ClosestBall = Child
				ClosestBallDFC = DistanceFromCharacter
			end
		end
	end

	if ClosestBallDFC then
		if ClosestBallDFC < Range then
			return true
		else
			return false
		end
	else
		return false
	end
end

function ChangeOwner(ball)
	game.ReplicatedStorage.ChangeOwner:FireServer(ball)
end
if hit.Parent:FindFirstChild("Humanoid") then
		
		local Player = game.Players.LocalPlayer
		local InputService = game:GetService("UserInputService")

		InputService.InputBegan:Connect(function(Input, Processed)
		if workspace.Configuration.Diving.Value == false then return end
		if not Processed then return end
		
		Player.Character:WaitForChild("Humanoid").PlatformStand = true
		Player.Character.Torso.RotVelocity = Vector3.new()
		Player.Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
		wait(1)
		Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
		Player.Character.Humanoid.PlatformStand = false
		Player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
		
	end)
end
1 Like

Did this work? If not pls tell me

Your above script works. But i have one problem with the script

I made another script that makes you fall when you press middle click.

It works but when put into this script that I made it fails to work.
dev vid - YouTube

When i touch the ball it doesn’t work but when I middle click it makes me fall. Do you have any solutions?