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: How can lclscrpt detect when modulescrpt value has changed?

Previous Thread :: Next Thread 
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
17 Apr 2017 04:26 AM
http://wiki.roblox.com/index.php?title=Saving_Player_Data

followed this above to setup my server script and module script.

Im saving gold and need to update my Custom UI's via local whenever the players gold value changes. However i have no clue how to send request for change from local script or how local script can detect when the value has been changed so it can update the UI. Help please, thanks
Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
17 Apr 2017 04:30 AM
:FireClient the server when it changes




Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
17 Apr 2017 04:37 AM
sorry i said that wrong. Where do i actually edit the gold value? if its in the local script how do i inform the module script of the local script's change request?
Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
17 Apr 2017 04:39 AM
You shouldn't let the client change the amount of gold


Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
17 Apr 2017 04:47 AM
Ok so how do i change their value for gold then? Im really curious and the wiki isnt being very helpful. I also dont want my game to be easily exploited either
Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
17 Apr 2017 04:48 AM
when do you want their gold to be changed?


Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
17 Apr 2017 04:56 AM
every two seconds for example like

while true do
wait(2)
---Gold Change goes here
end
Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
17 Apr 2017 04:58 AM
function PlayerStatManager:ChangeStat(player, statName, changeValue)
sessionData[player][statName] = sessionData[player][statName] + changeValue
end

I have this in my module script that im trying to get to fire. any idea how i can fire this from local script?
Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
17 Apr 2017 05:05 AM
Use it in a server script


Report Abuse
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
17 Apr 2017 05:37 AM
Alright moved to server script and then learnt about remote functions and tried using it here,

Local Script:

local Type = "Gold"
local Val = "10"
local Stats = StatsFunction:InvokeServer(Type,Val)

Server Script:

function StatsFunction.OnServerInvoke(Player,Type,Val)
PlayerStatManager:ChangeStat(Player, Type, Val)
end

function PlayerStatManager:ChangeStat(player, statName, changeValue)
sessionData[player][statName] = sessionData[player][statName] + changeValue
end

i printed out sessionData[player][statName] and it printed Gold. I realised what its tryna do here is do Gold + 10 which isnt returning a value because of the two different datatypes. Now just have to figure how to access the gold value in server script. It was so easy when i could just do Gold.Value with intValues lol
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