maxou2726
Messages postés1Date d'inscriptionsamedi 15 juillet 2023StatutMembreDernière intervention15 juillet 2023
-
15 juil. 2023 à 02:41
Bonjour, j'ai créé un serveur roblox et je me retrouve avec deux stat leader donc deux argent différent, mais je ne sais pas comment fusionner l'argent car avec le script de mon magnat je peux obtenir de l'argent dans le premier leaderstat et le dépenser pour quelque chose mais ça bloque quand je veux acheter des articles dans mon magasin de voiture car il utilise un autre leaderstats et donc une autre monnaie, que celle de mon tycoon qui m'empêche donc d'acheter une voiture merci d'avance.
voici le leaderstat que mon magnat utilise:
fonction onPlayerEntered(newPlayer)
if CTF_mode == truethenlocal stats = Instance.new("IntValue")
stats.Name = "leaderstats"local captures = Instance.new("IntValue")
captures.Name = "Captures"
captures.Value = 0
captures.Parent = stats
-- VERY UGLY HACK-- Will this leak threads?-- Is the problem even what I think it is (player arrived before character)?whiletruedoif newPlayer.Character ~= nilthenbreakend
wait(5)
end
stats.Parent = newPlayer
elselocal stats = Instance.new("IntValue")
stats.Name = "leaderstats"local kills = Instance.new("IntValue")
kills.Name = "KOs"
kills.Value = 0local deaths = Instance.new("IntValue")
deaths.Name = "Wipeouts"
deaths.Value = 0local cash = Instance.new("IntValue")
cash.Name = "Cash"
cash.Value = 0local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(newPlayer.Name)
if cashmoney ~= nilthen
cashmoney.Changed:connect(function()
cash.Value = cashmoney.Value
end)
end
kills.Parent = stats
deaths.Parent = stats
cash.Parent = stats
-- VERY UGLY HACK-- Will this leak threads?-- Is the problem even what I think it is (player arrived before character)?whiletruedoif newPlayer.Character ~= nilthenbreakend
wait(5)
endlocal humanoid = newPlayer.Character.Humanoid
humanoid.Died:connect(function() onHumanoidDied(humanoid, newPlayer) end )
-- start to listen for new humanoid
newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end )
stats.Parent = newPlayer
end
fin
voici le leaderstat avec lequel je voudrais fusionner l'argent pour pouvoir acheter des voitures :
function onPlayerEntered(newPlayer) wait(.5) local stats = Instance.new("IntValue") stats.Name = "leaderstats"
game.ReplicatedStorage.DealershipEvents.BuyCar.OnServerEvent:Connect(function(player,Car) local Price = game.ServerStorage.ShopCars:FindFirstChild(Car).Price.Value local Cash = player.leaderstats.Cash if Price and Cash.Value > = Prix et player.OwnedCars:FindFirstChild(Car).Value == true then Cash.Value = Cash.Value - Prix player.OwnedCars:FindFirstChild(Car).Value = true end end)