Value not work when it in script

hello i have script in my script there are problem my value work when i put it in script
it don’t work the problem the value work but number don’t change like i put before start 2 the damage be 2 but after that when i start i was want damage be 3 but it still when i current client it say the value is 2 but if i remove the value from script and play it say number is 3 so anyone can help me with this problem

1 Like

you can’t edit scripts while the game is running (as far as i know) if this is what you’re talking about

no i have value this value when add it to my sword like damage the value don’t change but when remove it from sword script it work again

1 Like

so you have a value in your sword, that is damage, when you change that value, the damage doesn’t change, correct ?

1 Like

are you changing the .Value property and not the instance?

1 Like

yep it dont change it still …

1 Like

can you show me your script ? send a picture if possible

--|| Services ||--
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.yoru.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 = "SwordVFX", 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		

			
			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 yoruWep = Character:FindFirstChild("you")

		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 = "SwordVFX", 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")
				local plrr = game.Players.LocalPlayer

				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 = "SwordVFX", 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
				local dmageee = game.ReplicatedStorage.Value
				GlobalFunctions:AddValue("BoolValue", "Stun", false, Victim, .55)
				if not Character:FindFirstChild("Feint") then
					DamageHandler.TakeDamage(Character,VHumanoid,ToolName,5+)
				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 = "SwordVFX", 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("you")
		WeaponSword = WeaponSword:Clone()
		WeaponSword.Name = "you"
		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 == "you" then
				v:Destroy()
			end
		end	
	end;	
}

return SwordCombat

could you send the line where the error happens?

yes

	GlobalFunctions:AddValue("BoolValue", "Stun", false, Victim, .55)
				if not Character:FindFirstChild("Feint") then
					DamageHandler.TakeDamage(Character,VHumanoid,ToolName,script.Parent.damge.Value)
				end

i put script change value but still dont work

did you write this whole script ?

i remove it but it say

while wait(0.01) do
	script.Parent.Value = game.Players.LocalPlayer.Data.Luck.Value
end

try changing this line

DamageHandler.TakeDamage(Character,VHumanoid,ToolName,5+)

its at around half way in the script

			if Victim:FindFirstChild("BlockHits") then
					local BlockHits = Victim:FindFirstChild("BlockHits")
					BlockHits.Value = BlockHits.Value - 1
				end
				local dmageee = game.ReplicatedStorage.Value
				GlobalFunctions:AddValue("BoolValue", "Stun", false, Victim, .55)
				if not Character:FindFirstChild("Feint") then
					DamageHandler.TakeDamage(Character,VHumanoid,ToolName,5+)
				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)

change the +5 to something higher

i know this but problem is when i put 5+script.parsent.damge.value

does the script error at some point?

no it all work but with damage it get damage from stats

go to ServerScriptService, then to SERVER, then to handlers, you should find a script called DamageHandler, open it and send me what you see

--|| Services ||--
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local Debris = game:GetService("Debris")
local ServerStorage = game:GetService("ServerStorage")

--|| Variables ||--
local RemoteFolder = ReplicatedStorage.Remotes

--|| Remotes ||--
local ClientRemote = RemoteFolder.SwordClient
local AnimationRemote = RemoteFolder.AnimationRemote

--|| Modules ||--
local GlobalFunctions = require(ReplicatedStorage.GlobalFunctions)
local Ragdoll = require(ServerStorage.Modules.Ragdoll)

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

local DamageHandler = {

	TakeDamage = function(Character,Inflicted,ToolName,Damage)		
		local Player = Players:GetPlayerFromCharacter(Character)
		local Humanoid = Character:FindFirstChild("Humanoid")

		if Inflicted.Health > 0 and Humanoid.Health > 0 then
			local EnemyCharacter = Inflicted.Parent
			local EnemyPlayer = Players:GetPlayerFromCharacter(EnemyCharacter)

			
					
				if EnemyCharacter:FindFirstChild("Choosing") == nil and EnemyCharacter:FindFirstChild("Feint") == nil then
					delay(.175,function() Inflicted.Health = Inflicted.Health - Damage; GlobalFunctions:DamageIndicator(EnemyCharacter,"-"..Damage) end)
				end
			end
		end
}

return DamageHandler

Is there another way? to add damge like blacksmith i do it take tool and upgrade it