Hello guys, first post, gonna make it simple.
So I am working on a game, (this is an alt because I thought people wouldn’t take my username seriously(I see differently now), but I am lazy). The game will feature 3 buttons on the gui, featuring the places: Campaign, Co-Op, and Multiplayer.
What I’m thinking, is there a way to add a currency system based off the earnings you get in the individual places so you can buy items in the shop on the main area?
So bassically:
Is it possible and how would I accomplish:
A currency system that registers after the game and sends it to the main place, along with EXP
A way for the items they buy to be applicable in the other games
Thanks,
Bac-Stab
yes there is, when you teleport a player then you can send some data (in this case maybe a tabel) with them to the other place and retrieve the data when they join. for the items they bought, you can also add them to the table.
this is a script when you send the data to another place
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local teleportData = {
money = player.money,
level = player.level
}
TeleportService:Teleport(placeId, player, teleportData)
and to recieve the data on the other server when the player joins, use this script
local TeleportService = game:GetService("TeleportService")
local teleportData = TeleportService:GetLocalPlayerTeleportData()
if teleportData then
local money = teleportData.money
local level = teleportData.level
end)
As the teleportData is transmitted by the client it is not secure. For this reason it should only be used for local settings and not sensitive items (such as the users’ score or in-game currency).
yeah you are right, I forgot about that it’s not save
you should use global datastore because this data is saved on the server and can also be saved when the player left the game. for a full tutorial I have a video here that really helps to create a datastore.
datastores can be retrieved on other servers via a key that you set up. This is all explained in the video