#Tycoon, Car dealership

66 messages · Page 1 of 1 (latest)

dreamy ploverBOT
#

studio** You are now Level 1! **studio

delicate phoenix
#

@everyone

#

Need help fast

#

i can pay 500 robux in about two and a half weeks

vagrant hinge
#

The 2 leaderstats issue

You have 2 leaderstats script, go disable one

I dont know how to find it
CTRL + Shift + F in Explorer → Search for "leaderstats" → disable one of the 2 scripts

The cash away

99% of the time its because you remove your money from a LocalScript, it wont work since whatever you change in a local script will apply to the player eyes only, so the server wont know for money changes

How can i solve that ?
Use a remote event

stiff oyster
vagrant hinge
delicate phoenix
#

thx*

vagrant hinge
#

np

stiff oyster
vagrant hinge
dreamy ploverBOT
#

studio** You are now Level 31! **studio

vagrant hinge
#

so if they are generated from script, its a good pratcite to not create 2 of them

delicate phoenix
#

ok

vagrant hinge
#

if you really wanna spend 500 robux, hire a scripter for this price to make your whole dealership system

stiff oyster
vagrant hinge
stiff oyster
#

oh no I actually should I forgot instances inside players have to be replicated

#

Haven't spend any time on scripting in ages

vagrant hinge
#

no but like here im just talking about leaderstats haha

#

mostly all leaderstats are created in a script but not all instances

stiff oyster
#

Still gets either replicated or created by a script

vagrant hinge
#

¯_(ツ)_/¯

stiff oyster
#

Isn't there a folder like starterplayer? or does that put it inside a folder?

#

I really can't remember

vagrant hinge
#

nope

#
[PlayerAdded](player)
  local folder = Instance.new("Folder")
  folder.Name = "leaderstats"
  local val1 = Instance.new("NumberValue", folder)
  val1.Name = "Foo"
  val1.Value = 0
  ... -- Create other values
  folder.Parent = player
end
#

or using roact

[PlayerAdded](player)
  local tree = Roact.createElement("Folder", { Name = "leaderstats" }, {
    Foo = Roact.createElement("NumberValue", {
      Value = 0
    }),
  })
  Roact.mount(tree, player, "leaderstats")
end
delicate phoenix
#

ok

#

Here is teh script that i am havign problems with btw: local DataStoreService = game:GetService("DataStoreService")
local PlayerStatsDS = DataStoreService:GetDataStore("CashSaveing_reset")
game.Players.PlayerAdded:Connect(function(NP)

local Key = "PDS-".. NP.UserId

local GetSave = PlayerStatsDS:GetAsync(Key)

local PSF = Instance.new("Folder", NP)
PSF.Name = "leaderstats"

local StatsFolder = script.Stats

for _, S in pairs(StatsFolder:GetChildren()) do
    local NS = Instance.new(S.ClassName, PSF)
    NS.Name = S.Name
    NS.Value = S.Value
end

if GetSave then
    for n, Stat in pairs(PSF:GetChildren()) do
        Stat.Value = GetSave[n]
    end
else
    local STS = {}
    for _, Stat in pairs(StatsFolder:GetChildren()) do
        table.insert(STS, Stat.Value)
    end
    PlayerStatsDS:SetAsync(Key, STS)
end

end)

game.Players.PlayerRemoving:connect(function(OP)

local Key = "PDS-".. OP.UserId

local StatsFolder = OP.leaderstats

local STS = {}
for _, Stat in pairs(StatsFolder:GetChildren()) do
    table.insert(STS, Stat.Value)
end

PlayerStatsDS:SetAsync(Key, STS)

end)

#

i still does not work

dreamy ploverBOT
#

studio** You are now Level 2! **studio

delicate phoenix
#

local DataStoreService = game:GetService("DataStoreService")
local PlayerStatsDS = DataStoreService:GetDataStore("CashSaveingreset")
game.Players.PlayerAdded:Connect(function(NP)

local Key = "PDS-".. NP.UserId

local GetSave = PlayerStatsDS:GetAsync(Key)

local PSF = Instance.new("Folder", NP)
PSF.Name = "leaderstats"

local StatsFolder = script.Stats

for , S in pairs(StatsFolder:GetChildren()) do
    local NS = Instance.new(S.ClassName, PSF)
    NS.Name = S.Name
    NS.Value = S.Value
end

if GetSave then
    for n, Stat in pairs(PSF:GetChildren()) do
        Stat.Value = GetSave[n]
    end
else
    local STS = {}
    for , Stat in pairs(StatsFolder:GetChildren()) do
        table.insert(STS, Stat.Value)
    end
    PlayerStatsDS:SetAsync(Key, STS)
end

end)

game.Players.PlayerRemoving:connect(function(OP)

local Key = "PDS-".. OP.UserId

local StatsFolder = OP.leaderstats

local STS = {}
for , Stat in pairs(StatsFolder:GetChildren()) do
    table.insert(STS, Stat.Value)
end

PlayerStatsDS:SetAsync(Key, STS)

end)
i still does not work

vagrant hinge
delicate phoenix
#

no but when i buy a car it wont take away cash from my tycoon leaderstat

vagrant hinge
#

did you used a remote event ?

delicate phoenix
#

no i dont know how to

#

or where to place it

vagrant hinge
sacred parrot
vagrant hinge
sacred parrot
#

Oh yeah cuz I have a problem

delicate phoenix
#

and there is a cash in side the script. if that makes the problems idk

sacred parrot
#

ohh

#

u are probably creating a new folder and cloning the one inside it as well

vagrant hinge
#

if you want to use gui you have to use remote event

#

i see you dont want to deal with them but if you wanna learn scripting, you will have too since its super usefull and super important

vagrant hinge
#

dont forget to check the wiki maybe there are the awnser

sacred parrot
# vagrant hinge what is it ?

when i try to access the profile Data (by doing profile.Data.Cash) it gives me an error "Attempt to index nil with data"

#

i checked on there no one said anything about it

#

checked on youtube no one said anything

#

checked on the devforum nothing there aswel

vagrant hinge
#

maybe there are people that know alot about them and that can helps you

sacred parrot
delicate phoenix
#

How do i put the script together with the remote event? I really dont know how to do this

vagrant hinge
#

just wait some time

sacred parrot
vagrant hinge
# delicate phoenix How do i put the script together with the remote event? I really dont know how t...
  1. Create a remote event in ReplicatedStorage and give it a name ( for example Toto )
  2. In yout local script do :
local remoteEvent = assert([ReplicatedStorage]:FindFirstChild("Toto")) -- Search for your remote event
local data1 = "Any data you want, here its a string"
local data2 = 42 -- and here its a number
remoteEvent:FireServer(data1, data2) -- you can add as many stuff as you want
  1. Get the data from your server script
local remoteEvent = assert([ReplicatedStorage]:FindFirstChild("Toto")) -- Search for your remote event

local function ServerEvent(player, data1, data2)
  print(player) -- The player who triggered it
  print(data1) -- "Any data you want, here its a string"
  print(data2) -- 42
end

remoteEvent.OnServerEvent:Connect(ServerEvent)
vagrant hinge
delicate phoenix
#

I need the script to know what the name of the currency is