Problem with changing value

i have a problem with changing a value with my script, the script doesn’t seem to be changing the value everytime i equip the item ( pickaxe ), here’s the script :

local pickaxe = script.Parent
local pickvalue = game:GetService("ReplicatedStorage").Tool.CurrentPickaxe
pickaxe.Equipped:Connect(function()
	pickvalue.Value = 1
        print(pickvalue.Value)
end)

the script doesn’t seem to change the pick value, in the output the pickvalue doesn’t show up for some reason
image
can anyone help me?

Edit :
the value is used in another script if it might help

local replicatedstorage = game:GetService("ReplicatedStorage")
local mining = replicatedstorage.Mining
local health = script.Parent
local pickstrength = replicatedstorage.Tool.CurrentPickaxe.Value
local dc = replicatedstorage.DisableControl
local dc2 = replicatedstorage.dc2
local strength = game:GetService("ReplicatedStorage").Tool.CurrentPickaxe.Value
local currentpickaxe = game:GetService("ReplicatedStorage").Tool.CurrentPickaxe

currentpickaxe.Changed:Connect(function()
	strength = currentpickaxe.Value
	print("strength changed to "..strength)
end)

Are you sure you’re equipping the tool, if the LocalScript is activated and if script.Parent is a tool?

image
robloxapp-20231102-1657128.wmv (810.1 KB)

Is the other script that the value is used in a global script? If so that’s probably why the first script isn’t changing the value. While it is changing the value, the change can only be seen on that specific client. You may have to change it to a global script.

Also if you’re trying to add one to the value every time the pickaxe is equipped you’ll need to do:

pickaxe.Value += 1

Hope this helped :slight_smile:

2 Likes

ty i changed it and it works.
(char limit)

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