Romal
Romal

Reputation: 11

make a datastore to save state of object

I did a localscript inside a programmed gui so that when I touch a block the gui appears,and the block is destroyed to the gui does not appear again, but I wanted the block to remain destroyed even when I leave the game and enter again

I tried to do several datastorage, but none worked, every time I reset the game, the block came back

my localscript in

startergui -> screengui

the localscript:

local frame = script.Parent.Frame
local text = script.Parent.Frame.TextLabel
local block = workspace:WaitForChild("Chest")
local sound = script.Sound
block.Touched:Connect(function(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if player and player == game.Players.LocalPlayer then
        sound:Play()
    block:Destroy()
    wait()
for i = 1,10 do
    text.TextTransparency -= 0.1
    text.BackgroundTransparency -= 0.1
    frame.Transparency -= 0.1
    wait(0.01)
end
wait(5)
for i = 1,10 do
    text.TextTransparency += 0.1
    text.BackgroundTransparency += 0.1
    frame.Transparency += 0.1
    wait(0.01)
end
    end
    end)


Upvotes: 1

Views: 27

Answers (0)

Related Questions