Hey all,
So I am receiving numbers from a client script and that all works. I want number values in replicated storage to say the correct new value. The output from the print is correct but nothing is changing when I go onto the server and also another script doesn’t detect it. Any ideas? Thanks
local rs = game:GetService("ReplicatedStorage")
local events = rs:WaitForChild("Events")
local voting = rs:WaitForChild("Voting")
local megVal = voting:WaitForChild("Megladon").Value
local normVal = voting:WaitForChild("Normal").Value
local viralVal = voting:WaitForChild("Viral").Value
events.VotingChangeRE.OnServerEvent:Connect(function(plr, meg, normal, viral)
megVal += meg
normVal += normal
viralVal += viral
print("Meg val:"..megVal.. ", Normal val:"..normVal..", Viral val:".. viralVal)
end)
Just a bit of clarification-- the problem here is that you can’t store a reference to an instance’s property inside of a variable. That can only be done with the whole instance or tables. That’s why tienke’s solution will fix your issue.