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

I've made a Data script game that I would like people to check out, any ideas for it?

Asked by 4 years ago

I pretty much did make a cool game testing my skills on scripting. Does it look alright?

(Also game link, not mandatory: https://www.roblox.com/games/4671042633/Data-Storage-Testing-Because-why-not)

Here's the script.

script.Parent.Touched:Connect(function(disk) --Something Detected.
    if disk:IsA("UnionOperation") then --Is it really the disk?
        script.Parent.Parent.ScreenName.ScreenNameGui.SG.DName.Text = "Name: "..disk.Name --Shows name of disk on different Gui
        local Data = disk:WaitForChild("Data")--Waits for Disk Children
        local Limit = disk:WaitForChild("Limit")
        if Data then --Does the disk child exist?
            if Limit.Value == 2 then --The Size of disk (200 Bytes)
                script.Parent.Parent.ScreenData.ScreenDataGui.SG.DataUsed.Text = "Bytes: "..#Data.Value
                script.Parent.Parent.Words.ScreenWordsGui.SG.ScrollingFrame.TextBox.Text = Data.Value
                script.Parent.Parent.Bar.BarGui.SG.Size.Size = UDim2.new(0, #Data.Value * Limit.Value ,0, 50)
                script.Parent.Parent.Bar.BarGui.SG.Size.SizeText.Text = #Data.Value.."/200"
            elseif Limit.Value == 1.5 then--The Size of disk (250 Bytes)
                script.Parent.Parent.ScreenData.ScreenDataGui.SG.DataUsed.Text = "Bytes: "..#Data.Value
                script.Parent.Parent.Words.ScreenWordsGui.SG.ScrollingFrame.TextBox.Text = Data.Value
                script.Parent.Parent.Bar.BarGui.SG.Size.Size = UDim2.new(0, #Data.Value * Limit.Value ,0, 50)
                script.Parent.Parent.Bar.BarGui.SG.Size.SizeText.Text = #Data.Value.."/250"
            elseif Limit.Value == 1 then--The Size of disk (300 Bytes)
                script.Parent.Parent.ScreenData.ScreenDataGui.SG.DataUsed.Text = "Bytes: "..#Data.Value
                script.Parent.Parent.Words.ScreenWordsGui.SG.ScrollingFrame.TextBox.Text = Data.Value
                script.Parent.Parent.Bar.BarGui.SG.Size.Size = UDim2.new(0, #Data.Value * Limit.Value ,0, 50)
                script.Parent.Parent.Bar.BarGui.SG.Size.SizeText.Text = #Data.Value.."/300"
            elseif Limit.Value == 0.5 then--The Size of disk (350 Bytes)
                script.Parent.Parent.ScreenData.ScreenDataGui.SG.DataUsed.Text = "Bytes: "..#Data.Value
                script.Parent.Parent.Words.ScreenWordsGui.SG.ScrollingFrame.TextBox.Text = Data.Value
                script.Parent.Parent.Bar.BarGui.SG.Size.Size = UDim2.new(0, #Data.Value * Limit.Value ,0, 50)
                script.Parent.Parent.Bar.BarGui.SG.Size.SizeText.Text = #Data.Value.."/350"
            elseif Limit.Value == 0 then--The Size of disk (400 Bytes)
                script.Parent.Parent.ScreenData.ScreenDataGui.SG.DataUsed.Text = "Bytes: "..#Data.Value
                script.Parent.Parent.Words.ScreenWordsGui.SG.ScrollingFrame.TextBox.Text = Data.Value
                script.Parent.Parent.Bar.BarGui.SG.Size.Size = UDim2.new(0, #Data.Value ,0, 50)
                script.Parent.Parent.Bar.BarGui.SG.Size.SizeText.Text = #Data.Value.."/400"
            end
        else
            return
        end
    else
        return
    end
end);
script.Parent.Parent.Open.CD.MouseClick:Connect(function()
    wait(0.5)
    script.Parent.Parent.ScreenName.ScreenNameGui.SG.DName.Text = "Name: N/A"
    script.Parent.Parent.ScreenData.ScreenDataGui.SG.DataUsed.Text = "Bytes: 0"
    script.Parent.Parent.Words.ScreenWordsGui.SG.ScrollingFrame.TextBox.Text = ""
    script.Parent.Parent.Bar.BarGui.SG.Size.Size = UDim2.new(0, 0,0, 50)
    script.Parent.Parent.Bar.BarGui.SG.Size.SizeText.Text = ""
end)

And ok, That is a lot to look at.

The 2,1.5,1,0 Numbers you see is hard to explain but i'll try.

The Value "Data" is a StringValue. There is a value inside of the disk called "Limit" and its a NumberValue. The limit determines the size of the disk, and the Limit changes a Gui size The Size limit is 400 because of the block from the Surface Gui on the part.

lets just say...

Data.Value = "Bla Bla Bla"
Limit = 2

script.Parent.Parent.Gui.SufaceGui.Frame.Size = UDim2.new(0,#Data.Value * 2,0,50)

And that would do a good amout of math to properly size the Gui to fit and fits to scale on the block.

0
Ok this is too much to look at and way to hard to explain. I could of done better than this... roblox136393 32 — 4y
0
Do yourself a favor and use more variables man instead of spamming "script.Parent.Parent" Ex_plore 62 — 4y

Answer this question