Note!: the scripts used to work before, they suddenly don’t work anymore, and no I haven’t changed anything about them…
This is one of the script where I need the value.
local remote = game.ReplicatedStorage.RemoteEvent
remote.OnServerEvent:Connect(function(Player)
Player.leaderstats.Money.Value -= 80
local pl = game.ReplicatedStorage.Players:WaitForChild(Player.Name) -- These parts
local chad = pl:FindFirstChild("Chad", true) --
chad:FindFirstChild("Health", true).Value = 100 -- the value is not changing.
end)
and no, there’s no error. Everything else works, so the money’s value is getting decreased.
--//Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
--//Variables
local remote = ReplicatedStorage.RemoteEvent
--//Functions
remote.OnServerEvent:Connect(function(player)
player.leaderstats.Money.Value -= 80
local pl = ReplicatedStorage.Players:FindFirstChild(player.Name)
local chad = pl and pl:FindFirstChild("Chad")
local health = chad and chad:FindFirstChild("Health")
print(health and "Successful" or "Unsuccessful")
if health then
health.Value = 100
end
end)
local remote = game.ReplicatedStorage.RemoteEvent
remote.OnServerEvent:Connect(function(Player)
Player.leaderstats.Money.Value -= 80
local pl = game.ReplicatedStorage.Players:WaitForChild(Player.Name) -- These parts
local chad = pl:FindFirstChild("Chad", true) --
local health = chad:FindFirstChild("Health", true)
print('Previous value:'..health.Value)
health.Value = 100
print('New value:'..health.Value)
while task.wait(1) do
print(health.Value)
end
end)
try this to monitor what happens after you change the value. I’m wondering if maybe it is being changed by something else
That’s your problem. Changing the value with a local script wont replicate that value to the server. So to the server the health value has never changed from 100. Fire a remote event from that local script to get the server to change the value whenever you want to raise/lower it