SlashTag
|
  |
| Joined: 27 May 2013 |
| Total Posts: 73 |
|
|
| 17 Jul 2016 02:26 PM |
game.ServerStorage.Lobbies.MainLobby.a1.Changed:connect(function(newValue)
Trying to detect a changed value.
This script is in the client's Gui. It doesn't work... Is this because the value exists in ServerStorage? I don't want it to be easily exploited, thats why I put values in there. How else should I go about doing this? |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 02:29 PM |
I don't believe ServerStorage is accessable by localscript.
I think what you'll have to do is localscript to detect the clicked, then use a serverevent to induce the value change.
Here you go: http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial#Server_Event
Read about server events. This should prompt you in the right direction. |
|
|
| Report Abuse |
|
|
East98
|
  |
| Joined: 17 Jun 2012 |
| Total Posts: 418 |
|
|
| 17 Jul 2016 02:30 PM |
The ServerStorage object exists only on the client so this means the script in the gui cant detect it because it exist only on the client. Id look into remote events for this sort of stuff.
http://wiki.roblox.com/index.php?title=API:Class/RemoteEvent
id place the events in the workspace since this exists on both the client and server and then use them to communicate between sever and clients
--East98 |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 02:32 PM |
ServerStorage exists on client?
I always thought it was server-side, as in 'server'storage |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 02:33 PM |
He made an error in his post, he meant it only exists on the server.
|
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 02:33 PM |
"Server"
"Server-Storage"
"Server"
Let that sink in. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 02:36 PM |
"HttpService:GetAsync" "GetAsync" "Async" >Asynchronous Let that sink in.
Seriously, GetAsync isn't asynchronous from Lua. Things aren't always as they seem.
|
|
|
| Report Abuse |
|
|
SlashTag
|
  |
| Joined: 27 May 2013 |
| Total Posts: 73 |
|
|
| 17 Jul 2016 03:12 PM |
| Where should I place the event? I want this to be un-explotable (or atleast harder to exploit... you know what I mean) so wouldn't that make placing the event in the workspace a little redundant? The idea is to have the server control things, I just want the client to listen. |
|
|
| Report Abuse |
|
|
sioux123
|
  |
| Joined: 18 Nov 2011 |
| Total Posts: 970 |
|
|
| 17 Jul 2016 03:13 PM |
ServerStorage can't be accessed by Client
Use ReplicatedStorage for Client-Server interaction |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 03:14 PM |
The event has to exist somewhere that the client can find, otherwise the client cannot activate the event.
If it's any consolation, the exploiter will not be able to access the script of the event, as far as I'm aware.
Store it in ReplicatedStorage |
|
|
| Report Abuse |
|
|
SlashTag
|
  |
| Joined: 27 May 2013 |
| Total Posts: 73 |
|
|
| 17 Jul 2016 03:20 PM |
It seems like if I use ReplicatedStorage I would no longer need a remote event? That is seen by both the server and the client, just like the workspace, no?
Again, getting this away from the client is the goal. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 03:33 PM |
| If you want to keep your scripts secret, put the scripts in ServerScriptStorage and put the event in ReplicatedStorage. |
|
|
| Report Abuse |
|
|
SlashTag
|
  |
| Joined: 27 May 2013 |
| Total Posts: 73 |
|
|
| 17 Jul 2016 03:43 PM |
| Oh my bad I thought you guys meant store all of the values in ReplicatedSotrage, but re-reading it appears you said just place the event in ReplicatedStorage and keep the values in ServerStorage as they are. I'll have to do some wiki reading to get it to work right, but now I get what to do/ how it works. Thanks for the help guys (: |
|
|
| Report Abuse |
|
|
SlashTag
|
  |
| Joined: 27 May 2013 |
| Total Posts: 73 |
|
|
| 17 Jul 2016 03:54 PM |
:/ Sorry about my constant questioning, obviously this is the first time I've used Remote Events...
--In the server game.Players.PlayerAdded:connect(function(player) local event = Instance.new("RemoteEvent") event.Parent = game.ReplicatedStorage event.Name = "a1 Client Event" script.Parent.a1.Changed:connect(function(newValue) event:FireClient(player) end) end)
So this fires the client's event. How do I send "newValue" to the client? |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 04:13 PM |
Oh right, you want to send it back too?
Well you'd have to use a ServerEvent I believe.
It's like tennis, Server and Client are player, and the ball is variables.
At least that's how I invision it. |
|
|
| Report Abuse |
|
|
SlashTag
|
  |
| Joined: 27 May 2013 |
| Total Posts: 73 |
|
|
| 17 Jul 2016 04:28 PM |
1) The server detects when a value existing on the server is changed. 2) Take the new value, let's call it X. 3) Fire the client's script. 4) What do I do to send "X" in the Server Script and what do I do to fetch "X" in the Client Script?
Isn't a ClientEvent started by the server and ran on the client? If so, I don't think a ServerEvent is needed; I only want to send server info to the client, no client info to the server. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 06:07 PM |
it depends on what kind of script you wrote the event with.
http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial#Server_Event
http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial#Client_Event
See these short bits for more detail.
Both are RemoteEvents, but if you use a local-script to program the onInvoke function then it will be executed locally
If you use a server-script to program the onInvoke function then it will be executed on the server |
|
|
| Report Abuse |
|
|