I’m trying to change a server value with a local script in a gui using :FireServer()
The problem that I’m having is the code runs without a problem without any errors but I see no results in the value changing.
Is there anything that I’m doing wrong or forgetting to do?
Thank’s in advance!
local TempTag = script.Parent.GenTag
local Generator = ""
for cycle, item in ipairs(workspace:GetDescendants()) do
if item.Name == ("GenTag") and item.Value == (TempTag.Value) then -- official add progress
Generator = item.Parent.Parent
end
end
UIS.InputBegan:Connect(function(inputObject)
if(inputObject.KeyCode==Enum.KeyCode.X)then
HoldingKey = true
print("Xed")
while HoldingKey do
ReplicatedStorage.GeneratorEvent:FireServer(Generator.Stats.Progress.Value == Generator.Stats.Progress.Value +1)
print("Fire")
wait(0.2)
end
end
end)
``
You’re passing Generator.Stats.Progress.Value == Generator.Stats.Progress.Value +1 so it’s probably always sending false and not the value you want, maybe change the value before sending it
I think we got it all wrong here. Instead of adding what change you want to make inside the parameter, I’d change it and add the value that you want to change (myValue.Value), and maybe as a second parameter add the amount, but the amount is best to be handled on the Server through the OnServerEvent function, protecting your value too by checking if it’s the correct one, so no exploiters could mess up with your values at any time.
Of course that wouldn’t fully protect your remote, just simply make your checks so you don’t get checked BOI have your remotes exploited by some kids.
If you need further help or some more explanation, you can ask.