Script is not printing value of int value

my script is for a magic book that shoots stuff. when you use it it takes away 15 mana. I have a script that increase mana by 5 every two seconds but it will not print that change. Mana is an intvalue inside of the players humanoid

script is a server script in startcharacterscripts

local mouselock = script.Parent:WaitForChild("MouseLock")
local char = script.Parent
local player = game.Players:GetPlayerFromCharacter(char)
local debounce = false
local book = player.Backpack.MagicBook
local orignal = game.ReplicatedStorage:WaitForChild("Magicbeam")
local meow = false
local offset = Vector3.new(0, 0, -2) 
local traveltime = 1
local magicbookcf = player.Backpack.MagicBook.Handle.CFrame

book.Activated:Connect(function()
	if script.Parent.Humanoid.Mana.Value <= 0 then
		wait()
	else
		if debounce == false then
			local getpos = mouselock:InvokeClient(player)
			debounce = true

			char.Humanoid.Mana.Value = char.Humanoid.Mana.Value - 15

			local copy = orignal:Clone()
			copy.Parent = game.Workspace
			copy.CFrame = book.Handle.CFrame*CFrame.new(offset)
			copy.CFrame = CFrame.new(copy.CFrame.p,getpos)
			print(getpos)

			local startingpos = copy.Position
			local bv = Instance.new("BodyVelocity")	
			bv.Velocity = copy.CFrame.lookVector * 50
			bv.Parent = copy
			copy.Parent = game.Workspace

			copy.Touched:Connect(function(hit)
				print(hit)
				if hit.Parent:FindFirstChild("Humanoid") then
					if  hit.Parent.Name == script.Parent.Name then
						wait()
					else
						if meow == false then
							meow = true
							print("HUMAN DIE")
							hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health -40
							copy:Destroy()
							meow = false
						end
					end
				elseif hit.Parent.Name == ("MagicBook") then
					wait()
				else
					print("Not Human")
					copy:Destroy()	
				end
			end)



			wait(2)

			print("Removing")
			copy:Destroy()
			debounce = false		
		end
	end
	
end)

script that increases mana

local char = game.Players.LocalPlayer.Character
local hum = char:WaitForChild("Humanoid")

local maxman = hum:WaitForChild("MaxMana")
local Mana = hum:WaitForChild("Mana")

local debounce = false

Mana.Changed:Connect(function(balls)
	if debounce == false then
		debounce = true
		repeat
			Mana.Value = Mana.Value + 5
			wait(2)
		until Mana.Value >= 100
		Mana.Value = 100
		debounce = false
	end
end)

local script inside a frame

pls help

2 Likes

Changes made in a LocalScript don’t replicate to server, so you need to handle it on the server (if you change the Mana in a LocalScript, the change will be seen by the client and only the client, nobody else will see it) instead, you should try using a server script

2 Likes