Problem with value dont work

hi my i want some help i am use free model but there problem with script it in sword the problem is when i put game.player.localplayer.playergui.value.value it dont take dmg from the value , so i think there are something Abbreviation so it stop the script from take dmg i will put script

local Players = game:GetService("Players")
local Debris = game:GetService("Debris")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local TweenService = game:GetService("TweenService")

--|| Remotes ||--
local SwordClient = ReplicatedStorage.Remotes.SwordClient
local AnimationRemote = ReplicatedStorage.Remotes.AnimationRemote
local CameraRemote = ReplicatedStorage.Remotes.CameraRemote

--|| Asssets ||--
local Target = ReplicatedStorage.Assets.MiscMeshes["BP"]

--|| Modules ||--
local GlobalFunctions = require(ReplicatedStorage.GlobalFunctions)
local HitboxModule = require(ServerScriptService.SERVER.sdarkblade.HitboxModule)
local DamageHandler = require(ServerScriptService.SERVER.Handlers.DamageHandler)

local HitboxData = {
	StartPoint = Vector3.new(2.75,2.75,2.75);
	EndPoint = Vector3.new(2.75,2.75,2.75)
}

local CameraData = {Size = 30; Length = .25}

local SwordCombat = {
	["Feint"] = function(Character,TaskName,FunctionName,Data)
		local Player = Players:GetPlayerFromCharacter(Character)
		GlobalFunctions:AddValue("BoolValue", "Stun", false, Character,.25)
		GlobalFunctions:AddValue("BoolValue", "Feint", false, Character,.35)

		SwordClient:FireAllClients({Module = "SwordVF", Function = "SwordFeint", Character = Character})
		AnimationRemote:FireClient(Player,"sword","StopClass")
	end;
	["Block"] = function(Character,KeyName,ToolName,Data)
		local Player = Players:GetPlayerFromCharacter(Character)
		local Humanoid = Character:FindFirstChild("Humanoid")

		if not GlobalFunctions:CheckValue(Player,"BlockCooldown") and not GlobalFunctions:CheckValue(Player,"%$@#^@#%$^@#") then
			AnimationRemote:FireClient(Player,"swordblocko","Play")
			local BlockHits = GlobalFunctions:AddValue("NumberValue", "BlockHits", 6, Character)

			local BlockingUI = Character.UpperTorso:FindFirstChild("Blocking")
			local Holder = BlockingUI:FindFirstChild("Holder")
			local Bar = Holder:FindFirstChild("Bar")
			local Text = Holder:FindFirstChild("Text")
			local T2 = Holder:FindFirstChild("Shadow")

			BlockingUI.Enabled = true		

			while GlobalFunctions:GetKeyHeld(Player,"MouseButton2","Mouse") and Character:FindFirstChild("BlockHits") do
				if Character:FindFirstChild("BlockHits") then
					GlobalFunctions:AddValue("BoolValue", "Stun", false, Character, .2)

					Humanoid.WalkSpeed = 7;
					Humanoid.JumpPower = 0;
					TweenService:Create(Bar,TweenInfo.new(.2,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0),{Size = UDim2.new(Character.BlockHits.Value/6,0,1)}):Play()
					Text.Text = Character.BlockHits.Value.."/"..6
					T2.Text = Text.Text
					wait(.1)
				end
			end
			GlobalFunctions:SetCooldown(Player,"BlockCooldown",1)
			BlockingUI.Enabled = false
			Humanoid.WalkSpeed = 11;
			Humanoid.JumpPower = 50;

			BlockHits:Destroy()
			AnimationRemote:FireClient(Player,"swordblocko","Stop")
		end
	end;

	["Sword"] = function(Character,KeyName,ToolName,Data)
		local Player = Players:GetPlayerFromCharacter(Character)
		local Root = Character:FindFirstChild("HumanoidRootPart")
		local Combo = Character:FindFirstChild("Combo")
		local ssoneWep = Character:FindFirstChild("Yoru")

		if Character:FindFirstChild("Stun") then return end
		if not GlobalFunctions:CheckCooldown(Player,"SwordSwingCooldown") then

			if Player.PlayerStats.KeysLogged.Value == 4 then
				GlobalFunctions:ChangeValue(Player.PlayerStats, "Set", "KeysLogged", 0)
				GlobalFunctions:AddValue("BoolValue", "Stun", false, Character, 1)
			end

			GlobalFunctions:SetCooldown(Player,"SwordSwingCooldown",.35)
			GlobalFunctions:ChangeValue(Player.PlayerStats, "Once", "KeysLogged", 1)
			AnimationRemote:FireClient(Player, "sword"..Player.PlayerStats.KeysLogged.Value, "Play")

			GlobalFunctions:AddValue("BoolValue", "%$@#^@#%$^@#", false, Character, .75)
			SwordClient:FireAllClients({Module = "SwordVF", Function = "SwordSwing", Character = Character})

			local hitResult,hitObject = HitboxModule.Region(Character,1,ToolName,HitboxData,ToolName,Player.PlayerStats:FindFirstChild("KeysLogged"))
			if hitResult == true then
				local Victim = hitObject.Parent
				local VHumanoid = Victim:FindFirstChild("Humanoid")
				local VRoot = Victim:FindFirstChild("HumanoidRootPart")

				delay(.15,function()
					local BG = Instance.new("BodyGyro"); BG.MaxTorque = Vector3.new(0,4e4,0); BG.P = BG.P * 10; BG.CFrame = CFrame.new(VRoot.Position,Root.Position) BG.Parent = VRoot
					_G.Debris(BG,.5)
				end)

				if Combo and Combo.Value < 5 then
					delay(.19,function()
						if not Victim:FindFirstChild("BlockHits") and not Victim:FindFirstChild("Choosing") then
							if not Character:FindFirstChild("Feint") then
								SwordClient:FireAllClients({Module = "SwordVF", Function = "SwordSlash", Character = Character, Victim = Victim})
								local BodyVelocity = Instance.new("BodyVelocity"); BodyVelocity.Name = "LittleKnockback" BodyVelocity.MaxForce = Vector3.new(1e8,1e8,1e8); BodyVelocity.Velocity = (VRoot.CFrame.p - Root.CFrame.p).unit * 5; BodyVelocity.Parent = Victim:FindFirstChild("Head")
								_G.Debris(BodyVelocity,.2)
							end
						end
					end)
				end

				if Victim:FindFirstChild("BlockHits") then
					local BlockHits = Victim:FindFirstChild("BlockHits")
					BlockHits.Value = BlockHits.Value - 1
				end

				GlobalFunctions:AddValue("BoolValue", "Stun", false, Victim, .55)
				if not Character:FindFirstChild("Feint") then
					DamageHandler.TakeDamage(Character,VHumanoid,ToolName,--here the problem-- )
				end
				delay(.185,function()
					if not Victim:FindFirstChild("BlockHits") and not Victim:FindFirstChild("Choosing") then
						GlobalFunctions:AddSound(Root, "Slash"..Player.PlayerStats.KeysLogged.Value, 1.75, false)
						VHumanoid:LoadAnimation(ReplicatedStorage.Animations.sword.HitReactions["HitReaction"..Combo.Value]):Play()
					else
						VHumanoid:LoadAnimation(ReplicatedStorage.Animations.sword.HitReactions.BlockHitReaction["bhitreaction"..math.random(1,2)]):Play()
					end
				end)

				GlobalFunctions:ChangeValue(Character, "Once", "Combo", 1)
				delay(.15,function()
					GlobalFunctions:ChangeValue(Character,"Once","Hits",1 )
				end)
				coroutine.wrap(function()

					if Combo.Value == 5 and not Victim:FindFirstChild("BlockHits") and not Victim:FindFirstChild("Choosing") then		
						VHumanoid:LoadAnimation(ReplicatedStorage.Animations.sword.HitReactions.HitReaction5):Play()

						wait(.185)

						SwordClient:FireAllClients({Module = "SwordVF", Function = "SwordLastHit", Character = Character, Victim = Victim})

						local EnemyVelocity = Instance.new("BodyVelocity"); EnemyVelocity.MaxForce = Vector3.new(1e5 ,1e5 ,1e5 ); EnemyVelocity.Velocity = (VRoot.CFrame.p - Root.CFrame.p).unit * 120; EnemyVelocity.Parent = Victim.Head
						_G.Debris(EnemyVelocity,.2)

						CameraRemote:FireClient(Player, "LightScreenShake")
						GlobalFunctions:AddSound(Character.HumanoidRootPart, "KnockbackTing", 1.5, false)			

						CameraRemote:FireClient(Player,"CreateBlur",CameraData)
					end
				end)()
			end

			if Player.PlayerStats.KeysLogged.Value >= 1 then
				spawn(function()
					GlobalFunctions:AddSound(Root, "SwingSharp1", 1.75, false)
					local ygm = Target:Clone(); ygm.CFrame = Root.CFrame * CFrame.new(0,0,-5); local bp = Instance.new("BodyPosition",Root); bp.Name = "Knockback"; bp.MaxForce = Vector3.new(1,1,1)* 800000; bp.D = 1800; bp.Position = ygm.Position; Debris:AddItem(bp,.2);  Debris:AddItem(ygm,.2)
				end)
			end
		end
	end;

	["Equipped"] = function(Character,KeyName,WeaponName,Data)
		local WeaponSword = ReplicatedStorage.Weapons:FindFirstChild("Yoru")
		WeaponSword = WeaponSword:Clone()
		WeaponSword.Name = "Yoru"
		WeaponSword.Parent = Character

		GlobalFunctions:AddSound(Character:FindFirstChild("HumanoidRootPart"), "UnSheath")
		local RightHand = Character:FindFirstChild("RightLowerArm")

		local Motor6D = Instance.new("Motor6D")
		Motor6D.Part0 = Character:FindFirstChild("RightHand")
		Motor6D.Part1 = WeaponSword:FindFirstChild("MainPrimaryPart")
		Motor6D.Parent = WeaponSword	
	end;

	["UnEquipped"] = function(Character,KeyName,WeaponName,Data)
		for _,v in pairs(Character:GetChildren()) do
			if v.Name == "Yoru" then
				v:Destroy()
			end
		end	
	end;	
}

return SwordCombat

the problem in line 125

1 Like

fixed

local Players = game:GetService("Players")
local Debris = game:GetService("Debris")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local TweenService = game:GetService("TweenService")

--|| Remotes ||--
local SwordClient = ReplicatedStorage.Remotes.SwordClient
local AnimationRemote = ReplicatedStorage.Remotes.AnimationRemote
local CameraRemote = ReplicatedStorage.Remotes.CameraRemote

--|| Asssets ||--
local Target = ReplicatedStorage.Assets.MiscMeshes["BP"]

--|| Modules ||--
local GlobalFunctions = require(ReplicatedStorage.GlobalFunctions)
local HitboxModule = require(ServerScriptService.SERVER.sdarkblade.HitboxModule)
local DamageHandler = require(ServerScriptService.SERVER.Handlers.DamageHandler)

local HitboxData = {
	StartPoint = Vector3.new(2.75,2.75,2.75);
	EndPoint = Vector3.new(2.75,2.75,2.75)
}

local CameraData = {Size = 30; Length = .25}

local SwordCombat = {
	["Feint"] = function(Character,TaskName,FunctionName,Data)
		local Player = Players:GetPlayerFromCharacter(Character)
		GlobalFunctions:AddValue("BoolValue", "Stun", false, Character,.25)
		GlobalFunctions:AddValue("BoolValue", "Feint", false, Character,.35)

		SwordClient:FireAllClients({Module = "SwordVF", Function = "SwordFeint", Character = Character})
		AnimationRemote:FireClient(Player,"sword","StopClass")
	end;
	["Block"] = function(Character,KeyName,ToolName,Data)
		local Player = Players:GetPlayerFromCharacter(Character)
		local Humanoid = Character:FindFirstChild("Humanoid")

		if not GlobalFunctions:CheckValue(Player,"BlockCooldown") and not GlobalFunctions:CheckValue(Player,"%$@#^@#%$^@#") then
			AnimationRemote:FireClient(Player,"swordblocko","Play")
			local BlockHits = GlobalFunctions:AddValue("NumberValue", "BlockHits", 6, Character)

			local BlockingUI = Character.UpperTorso:FindFirstChild("Blocking")
			local Holder = BlockingUI:FindFirstChild("Holder")
			local Bar = Holder:FindFirstChild("Bar")
			local Text = Holder:FindFirstChild("Text")
			local T2 = Holder:FindFirstChild("Shadow")

			BlockingUI.Enabled = true		

			while GlobalFunctions:GetKeyHeld(Player,"MouseButton2","Mouse") and Character:FindFirstChild("BlockHits") do
				if Character:FindFirstChild("BlockHits") then
					GlobalFunctions:AddValue("BoolValue", "Stun", false, Character, .2)

					Humanoid.WalkSpeed = 7;
					Humanoid.JumpPower = 0;
					TweenService:Create(Bar,TweenInfo.new(.2,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0),{Size = UDim2.new(Character.BlockHits.Value/6,0,1)}):Play()
					Text.Text = Character.BlockHits.Value.."/"..6
					T2.Text = Text.Text
					wait(.1)
				end
			end
			GlobalFunctions:SetCooldown(Player,"BlockCooldown",1)
			BlockingUI.Enabled = false
			Humanoid.WalkSpeed = 11;
			Humanoid.JumpPower = 50;

			BlockHits:Destroy()
			AnimationRemote:FireClient(Player,"swordblocko","Stop")
		end
	end;

	["Sword"] = function(Character,KeyName,ToolName,Data)
		local Player = Players:GetPlayerFromCharacter(Character)
		local Root = Character:FindFirstChild("HumanoidRootPart")
		local Combo = Character:FindFirstChild("Combo")
		local ssoneWep = Character:FindFirstChild("Yoru")

		if Character:FindFirstChild("Stun") then return end
		if not GlobalFunctions:CheckCooldown(Player,"SwordSwingCooldown") then

			if Player.PlayerStats.KeysLogged.Value == 4 then
				GlobalFunctions:ChangeValue(Player.PlayerStats, "Set", "KeysLogged", 0)
				GlobalFunctions:AddValue("BoolValue", "Stun", false, Character, 1)
			end

			GlobalFunctions:SetCooldown(Player,"SwordSwingCooldown",.35)
			GlobalFunctions:ChangeValue(Player.PlayerStats, "Once", "KeysLogged", 1)
			AnimationRemote:FireClient(Player, "sword"..Player.PlayerStats.KeysLogged.Value, "Play")

			GlobalFunctions:AddValue("BoolValue", "%$@#^@#%$^@#", false, Character, .75)
			SwordClient:FireAllClients({Module = "SwordVF", Function = "SwordSwing", Character = Character})

			local hitResult,hitObject = HitboxModule.Region(Character,1,ToolName,HitboxData,ToolName,Player.PlayerStats:FindFirstChild("KeysLogged"))
			if hitResult == true then
				local Victim = hitObject.Parent
				local VHumanoid = Victim:FindFirstChild("Humanoid")
				local VRoot = Victim:FindFirstChild("HumanoidRootPart")

				delay(.15,function()
					local BG = Instance.new("BodyGyro"); BG.MaxTorque = Vector3.new(0,4e4,0); BG.P = BG.P * 10; BG.CFrame = CFrame.new(VRoot.Position,Root.Position) BG.Parent = VRoot
					_G.Debris(BG,.5)
				end)

				if Combo and Combo.Value < 5 then
					delay(.19,function()
						if not Victim:FindFirstChild("BlockHits") and not Victim:FindFirstChild("Choosing") then
							if not Character:FindFirstChild("Feint") then
								SwordClient:FireAllClients({Module = "SwordVF", Function = "SwordSlash", Character = Character, Victim = Victim})
								local BodyVelocity = Instance.new("BodyVelocity"); BodyVelocity.Name = "LittleKnockback" BodyVelocity.MaxForce = Vector3.new(1e8,1e8,1e8); BodyVelocity.Velocity = (VRoot.CFrame.p - Root.CFrame.p).unit * 5; BodyVelocity.Parent = Victim:FindFirstChild("Head")
								_G.Debris(BodyVelocity,.2)
							end
						end
					end)
				end

				if Victim:FindFirstChild("BlockHits") then
					local BlockHits = Victim:FindFirstChild("BlockHits")
					BlockHits.Value = BlockHits.Value - 1
				end

				GlobalFunctions:AddValue("BoolValue", "Stun", false, Victim, .55)
				if not Character:FindFirstChild("Feint") then
					DamageHandler.TakeDamage(Character,VHumanoid,ToolName)
				end
				delay(.185,function()
					if not Victim:FindFirstChild("BlockHits") and not Victim:FindFirstChild("Choosing") then
						GlobalFunctions:AddSound(Root, "Slash"..Player.PlayerStats.KeysLogged.Value, 1.75, false)
						VHumanoid:LoadAnimation(ReplicatedStorage.Animations.sword.HitReactions["HitReaction"..Combo.Value]):Play()
					else
						VHumanoid:LoadAnimation(ReplicatedStorage.Animations.sword.HitReactions.BlockHitReaction["bhitreaction"..math.random(1,2)]):Play()
					end
				end)

				GlobalFunctions:ChangeValue(Character, "Once", "Combo", 1)
				delay(.15,function()
					GlobalFunctions:ChangeValue(Character,"Once","Hits",1 )
				end)
				coroutine.wrap(function()

					if Combo.Value == 5 and not Victim:FindFirstChild("BlockHits") and not Victim:FindFirstChild("Choosing") then		
						VHumanoid:LoadAnimation(ReplicatedStorage.Animations.sword.HitReactions.HitReaction5):Play()

						wait(.185)

						SwordClient:FireAllClients({Module = "SwordVF", Function = "SwordLastHit", Character = Character, Victim = Victim})

						local EnemyVelocity = Instance.new("BodyVelocity"); EnemyVelocity.MaxForce = Vector3.new(1e5 ,1e5 ,1e5 ); EnemyVelocity.Velocity = (VRoot.CFrame.p - Root.CFrame.p).unit * 120; EnemyVelocity.Parent = Victim.Head
						_G.Debris(EnemyVelocity,.2)

						CameraRemote:FireClient(Player, "LightScreenShake")
						GlobalFunctions:AddSound(Character.HumanoidRootPart, "KnockbackTing", 1.5, false)			

						CameraRemote:FireClient(Player,"CreateBlur",CameraData)
					end
				end)()
			end

			if Player.PlayerStats.KeysLogged.Value >= 1 then
				spawn(function()
					GlobalFunctions:AddSound(Root, "SwingSharp1", 1.75, false)
					local ygm = Target:Clone(); ygm.CFrame = Root.CFrame * CFrame.new(0,0,-5); local bp = Instance.new("BodyPosition",Root); bp.Name = "Knockback"; bp.MaxForce = Vector3.new(1,1,1)* 800000; bp.D = 1800; bp.Position = ygm.Position; Debris:AddItem(bp,.2);  Debris:AddItem(ygm,.2)
				end)
			end
		end
	end;

	["Equipped"] = function(Character,KeyName,WeaponName,Data)
		local WeaponSword = ReplicatedStorage.Weapons:FindFirstChild("Yoru")
		WeaponSword = WeaponSword:Clone()
		WeaponSword.Name = "Yoru"
		WeaponSword.Parent = Character

		GlobalFunctions:AddSound(Character:FindFirstChild("HumanoidRootPart"), "UnSheath")
		local RightHand = Character:FindFirstChild("RightLowerArm")

		local Motor6D = Instance.new("Motor6D")
		Motor6D.Part0 = Character:FindFirstChild("RightHand")
		Motor6D.Part1 = WeaponSword:FindFirstChild("MainPrimaryPart")
		Motor6D.Parent = WeaponSword	
	end;

	["UnEquipped"] = function(Character,KeyName,WeaponName,Data)
		for _,v in pairs(Character:GetChildren()) do
			if v.Name == "Yoru" then
				v:Destroy()
			end
		end	
	end;	
}

return SwordCombat

you left a extra comma

i know that , but the problem when i do damge is takeing from out of the script it not work