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

How To Save The Fact That An Image Is Visible?

Asked by 3 years ago

Hi all, how would I save the fact that an image is visible? I want to make a treasure hunt game for crystals, and I have this found GUI with these “Mystery” crystal images which act as placeholders for the crystal images which will appear when they get found (using region3).

Now, when a player “finds” a crystal by entering that crystals region3 area, I've got it so that the “Mystery” crystal image’s visibility to turn to false. Then the vacant space where the mystery image used to be to be is filled with the image of the crystal, by making the crystal image visible. I want this to save, so if the player leaves the game the "found" crystal images are all loaded in.

How do I edit my script to achieve this? Thanks.

--Found Script
local FoundRegions = game.Workspace:WaitForChild("FoundRegions")

local found = false

while wait(1) do
    for i, v in pairs(FoundRegions:GetChildren()) do

        found = false
        local region = Region3.new (v.Position - (v.Size/2),v.Position + (v.Size/2))
        local parts = game.Workspace:FindPartsInRegion3WithWhiteList(region, game.Players.LocalPlayer.Character:GetDescendants())

        for _, part in pairs(parts) do
            --Loop one by one through part table
            if part:FindFirstAncestor(game.Players.LocalPlayer.Name) then
                --Print "Player was found"
                found = true
                break 
            else
                found = false
                --Print "Player was not found in region"                
            end
        end

        if found == true then 
            --Make images visible
            if script.Parent.FoundClothing.Clothingframe.Scroll[v.Name].Visible == false then
                script.Parent.FoundClothing.Clothingframe.Scroll[v.Name].Visible = true
                local mystName = string.sub(v.Name, 1, (string.len(v.Name) - 5))
                script.Parent.FoundClothing.Clothingframe.Scroll[mystName].Visible = false
                --Turns visible off for mystery
                break
            end
        end

    end
end

Help is appreciated, thanks!

0
What do you mean Save the Fact? Can you explain a little bit more so we can know what are you talking about? Xapelize 2658 — 3y
0
By save the fact, I mean that I want to save the image so that it doesn't revert back to showing the "mystery" images when the player leaves and rejoins. If that makes sense? cricketjedi 2 — 3y
0
You gotta store the value key with the decal key and the userid key, load the decal on the client, this concept might help Xapelize 2658 — 3y
0
Could you give me a link or script for this just so I can get started? I find this helps a lot, I'm a visual learner. cricketjedi 2 — 3y
0
"I want this to save, so if the player leaves the game the "found" crystal images are all loaded in." Forgive me if I'm wrong, but it sounds like you need a Data Store - here is a quick video explaining how to use them. https://www.youtube.com/watch?v=eZKN5NBHDeM SpeedySixTen 50 — 3y

Answer this question