[Help] Why is my code not working?

This is my code that has 185 lines but line 44 never works.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Folder1 = ReplicatedStorage.Parry
local SuccessParry = Folder1.SuccessParry
local ErrorParry = Folder1.ErrorParry
local Folder2 = ReplicatedStorage.SpecificPlayer
local SpecificPlayerEvent = Folder2.SpecificPlayerEvent
local Folder3 = script.ParryParts
local Inner = Folder3.Inner
local Outer = Folder3.Outer
local ParryModuleScript = {}
local ParryProfiles = {}
local ParryNumber = 0
local ParryRunning = {}
local ParrySettings1 = 1
local Players = game:GetService("Players")
local P1A = script.Parry1Attempt
local P1S = script.Parry1Success
function ParryRequest4(Player,ParryProfile,Part)
	while ParryProfile[3] == true do
		task.wait(0.25)
		Part.TweenSpeed.Value = math.clamp(Part.TweenSpeed.Value - 0.050,0.1)
	end
end
function ParryRequest3(Player,ParryProfile,Part)
	task.spawn(ParryRequest4,Player,ParryProfile,Part)
	while ParryProfile[3] == true do
		task.wait()
		local TweenService = game:GetService("TweenService")
		local Info = TweenInfo.new(
			Part.TweenSpeed.Value,
			Enum.EasingStyle.Linear,
			Enum.EasingDirection.In
		)
		local NewProperty = {Position = Player.Character.Inner.Position}
		local Tween = TweenService:Create(
			Part,
			Info,
			NewProperty
		)
		Tween:Play()
	end
end
--This function wont work
function ParryRequest2(Player,ParryProfile,RecordedParryNumber)
	while ParryRunning[RecordedParryNumber] == true do
		task.wait()
		for Index_1,Value_1 in pairs(game:GetService("Workspace"):GetPartsInPart(Player.Character.Outer)) do
			if Value_1.Parent == game:GetService("Workspace").RoundParts and Value_1.Name == "RoundPart" then
				if Value_1.PlayerOne.Value == Player.UserId and Value_1.TweenPlayer.Value == Player.UserId then
					local PlayerTwoParryProfile = nil
					for Index_2,Value_2 in pairs(Players:GetChildren()) do
						if Value_1.PlayerTwo.Value == Value_2.UserId then
							for Index_3,Value_3 in pairs(ParryProfiles) do
								for Index_4,Value_4 in pairs(ParryProfiles[Index_3]) do
									if Index_4 == 1 and ParryProfiles[Index_3][1] == Value_1.PlayerTwo.Value then
										Value_1.TweenPlayer.Value = Value_2.UserId
										ParryProfile[2] = true
										SuccessParry:FireClient(Player)
										ParryProfile[3] = false
										PlayerTwoParryProfile = ParryProfiles[Index_3]
										PlayerTwoParryProfile[3] = true
										Value_1.TweenSpeed.Value = math.clamp(Value_1.TweenSpeed.Value - 0.125,0.1,5)
										ParryRunning[RecordedParryNumber] = false
										task.spawn(ParryRequest3,Value_2,PlayerTwoParryProfile,Value_1)
										local AnimationTrack = Player.Character.Humanoid.Animator:LoadAnimation(P1S)
										AnimationTrack:Play()
									end
								end
							end
						end
					end
				elseif Value_1.PlayerTwo.Value == Player.UserId and Value_1.TweenPlayer.Value == Player.UserId then
					local PlayerOneParryProfile = nil
					for Index_2,Value_2 in pairs(Players:GetChildren()) do
						if Value_1.PlayerOne.Value == Value_2.UserId then
							for Index_3,Value_3 in pairs(ParryProfiles) do
								for Index_4,Value_4 in pairs(ParryProfiles[Index_3]) do
									if Index_4 == 1 and ParryProfiles[Index_3][1] == Value_1.PlayerOne.Value then
										Value_1.TweenPlayer.Value = Value_2.UserId
										ParryProfile[2] = true
										SuccessParry:FireClient(Player)
										ParryProfile[3] = false
										PlayerOneParryProfile = ParryProfiles[Index_3]
										PlayerOneParryProfile[3] = true
										Value_1.TweenSpeed.Value = math.clamp(Value_1.TweenSpeed.Value - 0.125,0.1,5)
										ParryRunning[RecordedParryNumber] = false
										task.spawn(ParryRequest3,Value_2,PlayerOneParryProfile,Value_1)
										local AnimationTrack = Player.Character.Humanoid.Animator:LoadAnimation(P1S)
										AnimationTrack:Play()
									end
								end
							end
						end
					end
				end
			end
		end
	end
end
function ParryRequest1(Player,ParryProfile,RecordedParryNumber)
	table.insert(ParryRunning,RecordedParryNumber,true)
	task.spawn(ParryRequest2,Player,ParryProfile,RecordedParryNumber)
	task.wait(ParrySettings1)
	if ParryRunning[RecordedParryNumber] == true then
		ParryRunning[RecordedParryNumber] = false
		ErrorParry:FireClient(Player,false)
		task.wait(ParrySettings1)
		ParryProfile[2] = true
	end
end
function ParrySystem_Action2(Player)
	task.wait()
	local NewInner = Inner:Clone()
	local NewOuter = Outer:Clone()
	while true do
		task.wait()
		pcall(function()
			NewInner.Parent = Player.Character
			NewOuter.Parent = Player.Character
			NewInner.Position = Player.Character.HumanoidRootPart.Position
			NewOuter.Position = Player.Character.HumanoidRootPart.Position
		end)
	end
end
ParryModuleScript.ParrySystem = function(Player,ActionNumber)
	if ActionNumber == 1 then
		local ParryProfileExists = nil
		local ParryProfile1 = nil
		for Index_1,Value_1 in pairs(ParryProfiles) do
			for Index_2,Value_2 in pairs(ParryProfiles[Index_1]) do
				if Index_2 == 1 and Value_2 == Player.UserId then
					ParryProfileExists = true
					ParryProfile1 = ParryProfiles[Index_1]
				end
			end
		end
		if ParryProfileExists == true then
			if ParryProfile1[2] == true then
				ParryProfile1[2] = false
				ParryNumber += 1
				task.spawn(ParryRequest1,Player,ParryProfile1,ParryNumber)
				local AnimationTrack = Player.Character.Humanoid.Animator:LoadAnimation(P1A)
				AnimationTrack:Play()
			else
				ErrorParry:FireClient(Player,true)
			end
		else
			table.insert(ParryProfiles,{})
			local ParryProfile2 = ParryProfiles[#ParryProfiles]
			table.insert(ParryProfile2,1,Player.UserId)
			table.insert(ParryProfile2,2,false)
			table.insert(ParryProfile2,3,false)
			ParryNumber += 1
			task.spawn(ParryRequest1,Player,ParryProfile2,ParryNumber)
			local AnimationTrack = Player.Character.Humanoid.Animator:LoadAnimation(P1A)
			AnimationTrack:Play()
		end
	elseif ActionNumber == 2 then
		task.spawn(ParrySystem_Action2,Player)
		return true
	elseif ActionNumber == 3 then
		local ParryProfileExists = nil
		for Index_1,Value_1 in pairs(ParryProfiles) do
			for Index_2,Value_2 in pairs(ParryProfiles[Index_1]) do
				if Index_2 == 1 and Value_2 == Player.UserId then
					ParryProfileExists = true
				end
			end
		end
		if ParryProfileExists == false then
			table.insert(ParryProfiles,{})
			local ParryProfile = ParryProfiles[#ParryProfiles]
			table.insert(ParryProfile,1,Player.UserId)
			table.insert(ParryProfile,2,true)
			table.insert(ParryProfile,3,false)
		end
	elseif ActionNumber == 4 then
		print(4)
	elseif ActionNumber == 5 then
		print(5)
	elseif ActionNumber == 6 then
		print(6)
	end
end
return ParryModuleScript

please help!

11 Likes

You could be more descriptive. Like, show the error in output about why that function doesn’t work, what are you trying to achieve, etc


  1. What do you want to achieve? Keep it simple and clear!

  2. What is the issue? Include screenshots / videos if possible!

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

3 Likes

There are no errors, but it still doesn’t work

try printing out and check which line is actually exactly isn’t working

1 Like

i think just debug and see why it not working

yeah but what isn’t working, the parry not reducing the damage or what?

ParryRequest1 Doesn’t work, it’s probably not finding something, but there are 0 errors on the server

2 Likes

To me, I think its β€œasking too much” for the community to read your entire script to find why β€œsomething is not working”. At least you should debug and find what is not working and give details on what you are doing on that script.
Anyway, there is always someone with enough free time to read and test a whole script and find whats the issue… but seems not fair I think

2 Likes

I found out after for index_3,value_3 the code below never works, And my script is I’m trying to make the game blade ball parry.

Print the content of ParryProfiles table before performing the loop for Index_3,Value_3 in pairs(ParryProfiles) do. Perhaps ParryProfiles table could be empty, seems that is populated on different parts and steps of the code, but first check that table to see that the values you expect are actually there

2 Likes

You should not nest that many if/for statements. That usually causes logic errors and issues with your code, and overall makes debugging a nightmare.

Yes I know but I made the values on the script So exploiters can’t read the Values, and thats why there are so much if/fors.

Thank you everyone, I finally solved it.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.