generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Why isn't the value being changed?

Previous Thread :: Next Thread 
LeRiceFarmer is not online. LeRiceFarmer
Joined: 08 Jan 2012
Total Posts: 2583
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
LeRiceFarmer is not online. LeRiceFarmer
Joined: 08 Jan 2012
Total Posts: 2583
22 Jul 2017 09:46 PM
val used to be game.ServerStorage.SongVotes.Value but I changed it.


Report Abuse
caca50 is not online. 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
DoctorFartPhD is online. DoctorFartPhD
Joined: 02 Jan 2013
Total Posts: 40
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image