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

How can you use DataStore for certain Gui's? [closed]

Asked by 6 years ago
Edited 6 years ago

Is there a way to save a certain gui to a specific player so when the player leaves, the gui appears the same to that specific person?

For example, if i had a gui shop and a player pressed a 'buy' button to purchase a pet and the buy button changes to an 'equip' button, how can i make it so that it stays as an equip button for that certain player when they leaves the game?

Another example is when i have a store gui and a certain gear is locked with a locked icon, and when a player buys the gear, the locked icon would go away and they would be able to use it, how can i keep the gear unlocked for that certain player when they leaves?

--This is my Line of Code so far that is in a Local Script inside the buy button:

local player = game.Players.LocalPlayer
local gems = player:WaitForChild('leaderstats').Gems
local buyButton = script.Parent
local errorSound = game.Workspace.Error
local boughtSound = game.Workspace.ChaChing
local boughtMessage = script.Parent.Bought
local errorMessage = script.Parent.Parent.Parent.Parent.Parent.ErrorMessage
local gemImage = script.Parent.Gem

script.Parent.MouseButton1Click:connect(function()
    if gems.Value >= 50 and not player.Backpack:FindFirstChild('HyperlaserGun') and not player.StarterGear:FindFirstChild('HyperlaserGun') and not player.Character:FindFirstChild('HyperlaserGun') then
        game.Lighting.WeaponFolder.HyperlaserGun:Clone().Parent = player.Backpack
        game.Lighting.WeaponFolder.HyperlaserGun:Clone().Parent = player.StarterGear
        gems.Value = gems.Value - 50
        boughtSound:Play()
        boughtMessage.Visible = true
        gemImage.Visible = false
    else
        if player.Backpack:FindFirstChild('HyperlaserGun') or player.StarterGear:FindFirstChild('HyperlaserGun') or player.Character:FindFirstChild('HyperlaserGun') then
            errorMessage.Visible = true
            errorSound:Play()
            errorMessage.Text = 'You already own this item!'
            wait(1.5)
            errorMessage.Visible = false
            errorMessage.Text = "You don't have enough Gems to purchase this!"
        else    
        errorMessage.Visible = true
        errorSound:Play()
        wait(1.5)
        errorMessage.Visible = false            

        end

    end
end)

0
Where is your attempt at this? User#19524 175 — 6y
0
the buy/equip button example BrawlBattle 15 — 6y
0
^ which u didnt give :C TheeDeathCaster 2368 — 6y
0
use a datastore to check if they bought it when they join the game, datastores for second thing also RobloxianDestory 262 — 6y
0
also, he was asking "is there a way" he wasnt asking for a script. oof nvm., didnt read the title RobloxianDestory 262 — 6y

Closed as Not Constructive by User#19524 and minikitkat

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?