How would I go about making a tycoon?

Hiya, how would I go about making a tycoon? As in how would you load certain parts/models in when they are purchases and so on; as I am interested in making a tycoon but I am not sure which approach I want to take.

Thank you.

Well, you could use „Tycoon Kits“, for example Zed‘s Tycoon Kit
when you don’t want to script much. And try to not use the Toolbox

2 Likes

Hiya, I’d rather script my own custom one to be honest.

3 Likes

Well it would be a fairly large matter, as there are quite a few fundamentals to tycoons. But what you most likely are thinking of are the small green buttons that grant you items and pieces of your building, which would be super simple to script. Plus the gear boxes/tubes, which would also be pretty easy to script.

1 Like

Yah so how would u do that aaaaaa

1 Like

Store the pieces in ReplicatedStorage.
In ReplicatedStorage, create a folder for each slot and store the pieces. Load them in whenever you need to.

Basically for the buildings you’d just go:

-- This is written like a normal Script, not a LocalScript.
local TouchPad = script.Parent
local Building = --perhaps inside a folder in ServerStorage or ReplicatedStorage.
-- It would probably be something like a wall, or a roof.
local Price = 1000 --or something else
local PlayerPlot = script.Parent.Parent --or something a little more sophisticated

TouchPad.Touched:Connect(function(otherPart)
local Character = otherPart.Parent
local CharacterHumanoid = otherPart.Parent:FindFirstChildOfClass("Humanoid")
if Character and CharacterHumanoid then
local Player = game.Players:GetPlayerFromCharacter(Character)
if Player then
local PlayerLeaderstats = Player:FindFirstChild("leaderstats") -- or a simple value inside of the player
local MoneyValue = PlayerLeaderstats:FindFirstChild("Money")
if MoneyValue and MoneyValue.Value > Price then
local BuildingClone = Building:Clone()
BuildingClone.Parent = PlayerPlot
 end
 end
 end
end)
1 Like

You could also take some inspiration from zed’s tycoon kit but i made some tycoon kits in the past and they’re fairly easy to make, you would have to make a main module for the tycoon itself and put in some functions such as :Purchase(modelName), :Load(tycoon, player), :Grant(tycoon, player), etc…

Also there would be alot of communciation between client and server for instance .Touched for the buttons, .AddMoney, etc…

Make sure to keep your code organized cause the module will eventually become super messy.

1 Like

Yeah, I would recommend using a ModuleScript, if anyone doesn’t know how it works, check out All about Object Oriented Programming

You put your .Touched buttons on the client and used RemoteEvents? O_O

1 Like

Well you could also do that actually putting the buttons on the client makes it way easier for the server to handle lag and replication issues so that should be prioritized but up to you, using .Touched should always be executed on the client, using it on the server will not detect it precisely.

2 Likes

You shouldn’t store it in ReplicatedStorage. Instead, store it in ServerStorage so the client can’t see it but the server can.

1 Like

Why send that over the server/client boundary when you could just do the .Touched events on the server? It’s reliable enough, in this case, for hit detection to not matter all that much + you don’t need to use a RemoteEvent.

1 Like

No, the server can’t handle .Touched events as precisely, it could but there would be a delay and networking issues. Using it on the client is more efficient.

1 Like

I’ll experiment with it later, but you could be right. I’ve just always done .Touched (for tycoons) on the server.

1 Like

Do you think proximityprompts could work better than touch events?

2 Likes

It could definitely work better, but i recommend using touch events as it is easier for the player to purchase a button than clicking everytime

The Touched event is sent from the client to the server (because the client has network ownership of the character), so on the server it’s just as precise.

If you use it on the client it needs to be sent to the server either way, so using it on the server is basically the same as using it on the client then sending it to the server. I think it might technically be more efficient though, since it would only need to detect the touched event on the client’s side. Either way works fine though. As far as I’m aware, most tycoons do it from the server.

Edit:

Never mind, I wasn’t aware of this problem! I’ll do some testing and look into it, thanks for letting me know.

I’ve debugged that subject months ago and i can confirm that after resetting your character, touch events become more and more delayed, having connections on the server shouldn’t be the way to go, you could be having memory leaks without knowing and a massive lag, however creating these connections on the client will disconnect them upon exit.

1 Like

four steps

  1. design your tycoon the way you want it to look when completed. Put droppers, the conveyor, and the sell part, as well as things like item givers and several floors. Also make the money collector if you want it. Group everything as one model.
  2. in the model, create an object value to keep track of the owner. Create the purchase door and make it so that if there is no owner, the value is set to the player who touched the door.
  3. create purchase buttons that place the target object(s) in ServerStorage. When the player touches the buttons, the corresponding objects will be removed from ServerStorage and placed in the tycoon model.
  4. for objects that can only be purchased if another is first, place the purchase button in the model of the needed purchase. Like if you need to finish the walls to buy the ceiling, you would place the button for the ceiling in the model of the walls.
2 Likes