Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Easiest Way to make a GUI to show the amount of money earned by the player?

Asked by 4 years ago
Edited 4 years ago

I recently tried my hands on coding a simulator game in roblox.

I am thinking of making a GUI so the player no need to look though the player tab list to see how much they have earned.

What might be the fast way to do this? SideNote, The current code I have has the Strength Value directly impacted on the Height of the player. Is there any way so that the player's height would remain after purchasing an upgrade?

Points Script are as below:

local DataStore = game:GetService("DataStoreService")
local PointsData = DataStore:GetOrderedDataStore("Points")

game.Players.PlayerAdded:Connect(function(plr)
    local points = PointsData:GetAsync(plr.UserId)
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    local pointsValue = Instance.new("IntValue", leaderstats)
    pointsValue.Value = points
    leaderstats.Parent = plr
    pointsValue.Name = "Strength"
end)

game.Players.PlayerRemoving:Connect(function(plr)
    local strength = plr.leaderstats.Strength.Value
    PointsData:SetAsync(plr.UserId,strength)
    print("Saved data")
end)

game.ReplicatedStorage.BuyItem.OnServerEvent:Connect(function(plr,weight)
    if plr.leaderstats.Strength.Value >= weight.Price.Value then
        plr.leaderstats.Strength.Value = plr.leaderstats.Strength.Value - weight.Price.Value
        local newWeight = weight:Clone()
        local oldWeight = plr.Backpack:FindFirstChildOfClass("Tool") or plr.Character:FindFirstChildOfClass("Tool")
        oldWeight:Destroy()
        newWeight.Parent = plr.Backpack
    end
end)

Thank you!

0
You could make a TextLabel and code it in a LocalScript so that it can see how much strength you have. Then you can make the Text in the TextLabel always show the amount of strength you have. I don't really understand your second question, so could you rephrase it for me and other people who might answer? Thank you! AntiWorldliness 868 — 4y

Answer this question