|
| 22 Jul 2017 09:45 PM |
local val = game.Lighting.SongVotes.Value
game.ReplicatedStorage.Remotes.NumChange.OnServerEvent:connect(function() print("Nice") val = val + 1 end)
Nice gets printed in output but there are no errors and the value doesn't change...
|
|
|
| Report Abuse |
|
|
|
| 22 Jul 2017 09:46 PM |
val used to be game.ServerStorage.SongVotes.Value but I changed it.
|
|
|
| Report Abuse |
|
|
caca50
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 2037 |
|
|
| 22 Jul 2017 09:51 PM |
local val = game.Lighting.SongVotes
val.Value = val.Value+1
Also, don't use Lighting.
What you're doing when you create the variable like this: local val = game.Lighting.SongVotes.Value
Is just simply referencing the value.
So let's say it's '5' then the variable holds the value '5'
You can add one to that or whatever math you want, and it will change the variable, however, it won't change the VALUE.
That is because, as I said, it's referencing the value itself, not object that holds the value. If that makes any sense
Roblox.Forum.Scripters:1: bad argument #1 to 'intellect' (number expected, got nil) |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2017 09:52 PM |
| The first line localizes the value of the SongVotes into a variable. This variable is getting changed on the server event, not the value of the object. Instead, localize the object and change it's value. |
|
|
| Report Abuse |
|
|