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: Local Scripts

Previous Thread :: Next Thread 
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
02 May 2012 07:22 PM
Is there a way to...

A) Run a local script once, and then have it run, even when the player respawns.

B) If you save stuff in _G. w/ a local script, does that negate the need to have values for your stats that aren't going to be communicating with the server.

C) Is there an effective way to communicate server to client.
Report Abuse
JulienDethurens is not online. JulienDethurens
Joined: 11 Jun 2009
Total Posts: 11046
02 May 2012 07:29 PM
A) No.
B) No. Well, yes, but not if you want to do it the right way.
C) No.
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
02 May 2012 07:30 PM
How would you address the problem of C then. That's the main thing.
Report Abuse
DonnyTheDemented is not online. DonnyTheDemented
Joined: 29 May 2010
Total Posts: 1413
02 May 2012 07:33 PM
A)Yes;
if not _G.ThisScraptRan then --assuming you have it in starterpack
_G.ThisScraptRan=true
script.Disabled=true
else
script:Destroy()
end
--Please note, you will have to account for a lot of errors that can occur on respawn
Report Abuse
DonnyTheDemented is not online. DonnyTheDemented
Joined: 29 May 2010
Total Posts: 1413
02 May 2012 07:37 PM
Client->Server
I would have a script with a string value for each player in it+listening event for .changed and use http://wiki.roblox.com/index.php/RbxUtility_(Library) to transfer tables as strings.

Server->Client
String value parented to player, same thing as above.
Report Abuse
Anaminus is not online. Anaminus
Top 100 Poster
Joined: 29 Nov 2006
Total Posts: 5945
02 May 2012 08:04 PM
A simple way to do client-to-server communication would be to have a Configuration object in the Workspace (so that it replicates), and have the server listen for children being added to it. Then clients can drop Value objects into it and the server will pick them up.
You could expand it to let the server send a response by having the client wait for a child to be added to the sent Value object.

It's also simple to do the reverse the process for server-to-client. Just have all clients listening, and the server making requests. The only real difference is that you have to include which client the server wants to communicate with in the request, and only have clients that match respond.

You could even do client-to-client, if you wanted.
Report Abuse
JulienDethurens is not online. JulienDethurens
Joined: 11 Jun 2009
Total Posts: 11046
02 May 2012 08:09 PM
@Anaminus

But that method is not really what I'd call "effective". It's not like there's any effective method to do it anyway. And there'd be no way for the devs to create an effective way to do it, because replication is more complicated than that.

You can't replicate functions, nor tables. The problem of tables, assuming you exclude threads (threads = the type of coroutines), functions and userdatas, can be solved with values, though. Or by converting them to strings.
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
02 May 2012 08:20 PM
So you have to do a drop/collect method in communications. You can use strings to save a copy of the table. I guess the real problem is transmitting the table back and forth again, and how you should handle updates efficiently.

This problem, it's quite annoying.
Report Abuse
JulienDethurens is not online. JulienDethurens
Joined: 11 Jun 2009
Total Posts: 11046
02 May 2012 08:23 PM
Why would you use strings for tables when you can use multiple values...?
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
02 May 2012 08:24 PM
Efficiency. And the fact that the code exists for the table > string, and not for the values.

Unless you want to write it for meh. :)
Report Abuse
Anaminus is not online. Anaminus
Top 100 Poster
Joined: 29 Nov 2006
Total Posts: 5945
02 May 2012 09:27 PM
I found the method to be pretty useful, considering the limitations.

You could use a bunch of values for tables, but you'd have to figure out how to verify that everything has been replicated before continuing. It's a lot easier to just wait on one string.
Even so, you shouldn't have to send entire tables back and forth. It's a good thing to reduce network traffic as much as necessary.
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
02 May 2012 10:27 PM
I probably would only send over stuff I need. I think the best way to do this for a communal thing (Like a shop, or, say, a forum), which all players may be accessing is like this?

(-> means sending data/collecting data)

Local Script, parse -> Drop Point (.ChildAdded) -> Server Script `Handler` takes it, parse -> Drop off into new drop box -> Other local scripts (Other players) pick it up. (.Changed)

Is that the best method to do it?
Report Abuse
DatBass is not online. DatBass
Joined: 30 Apr 2012
Total Posts: 186
02 May 2012 11:25 PM
A)) Yes
script.Parent=nil
--code

Magic & Tolerance
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
03 May 2012 05:37 AM
https://code.google.com/p/google-diff-match-patch/

That should help you with updates, assuming that you're using strings for serialization.
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