How do I reference a currency from a leaderstats script to a Shop script

im getting confused both of you guys are giving me answers and I dont know whoms to do. A remote event fires a script or a piece of script to another script? do i put a local script in starter player scripts and do my gui there? I am so confused right now

All a RemoteEvent does is provide a way for a local script and server script to signal each other with information!

Yes, or you could put the local script in the GUI if you wanted to for your own personal organization reasons

im currently watching a tut on remote events so its starting to make since on remote events

1 Like

Do as Floof said. I agree with what he is saying (I personally will stick to serverscripts in stores I don’t think of it as weird but as a way of reducing the amount of sanity checks/remote events).

1 Like

One of my friends has a game called Dysfunctional Diner and he has a Module Script called Purchase Handler that im assuming doesnt use remote events because its on ServerScriptService, almost all of his scripts are module scripts except 2 Data handlers, one is server and one is local, do u have an idea on that?

1 Like

Yeah I still think you should use a ServerScript for obvious reasons but sanity checks can be reduced with things like server side price handling and I’m pretty sure you can’t even get events like MouseButton1Click or any sort of GUI activation from the Server, correct me if I’m wrong though.

The location doesn’t influence stuff like that with the script. A script in ServerScriptService is just as likely to use RemoteEvents as a script located anywhere else.

This is exactly how my game is structured. It’s an advanced method of organization that can reduce clutter and improve the ability to refactor code depending on how it’s executed. It’s not something you need to worry about much as a beginner but is definitely a pattern you should consider as you grow your skills.

oh he does have remotesssssssss

1 Like

so make a local script in player scripts thats suppossed to be the client and server scripts are the server?

1 Like

and can you make it into a module script and do the PurchaseHandling there?

1 Like

Yep!

Technically you could but I don’t recommend this if you’re a beginner. It’s a bit more complicated to get set up and might be overwhelming if you don’t know what you’re doing.

ig ill convert my game into modulescript later and just do regular scripts and local scripts for now

1 Like

one last thing, so can you make a summary of all we just said? so i can start on the coding for remote events and all that stuff, and i can just get the player by doing the built-in roblox thing and refrencing leaderstats. floofy please and thank u for ur time

To handle the shop, have a LocalScript and server Script that handle the shop GUI and purchase starting and the actual process of checking the player separately. Use a remote event to send a signal (and any associated information) and use the player parameter you receive to get the player object.

It works! Thank you so much!!! I have learned so much in 1 hour lol

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.