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 5 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.

01script.Parent.Touched:Connect(function(disk) --Something Detected.
02    if disk:IsA("UnionOperation") then --Is it really the disk?
03        script.Parent.Parent.ScreenName.ScreenNameGui.SG.DName.Text = "Name: "..disk.Name --Shows name of disk on different Gui
04        local Data = disk:WaitForChild("Data")--Waits for Disk Children
05        local Limit = disk:WaitForChild("Limit")
06        if Data then --Does the disk child exist?
07            if Limit.Value == 2 then --The Size of disk (200 Bytes)
08                script.Parent.Parent.ScreenData.ScreenDataGui.SG.DataUsed.Text = "Bytes: "..#Data.Value
09                script.Parent.Parent.Words.ScreenWordsGui.SG.ScrollingFrame.TextBox.Text = Data.Value
10                script.Parent.Parent.Bar.BarGui.SG.Size.Size = UDim2.new(0, #Data.Value * Limit.Value ,0, 50)
11                script.Parent.Parent.Bar.BarGui.SG.Size.SizeText.Text = #Data.Value.."/200"
12            elseif Limit.Value == 1.5 then--The Size of disk (250 Bytes)
13                script.Parent.Parent.ScreenData.ScreenDataGui.SG.DataUsed.Text = "Bytes: "..#Data.Value
14                script.Parent.Parent.Words.ScreenWordsGui.SG.ScrollingFrame.TextBox.Text = Data.Value
15                script.Parent.Parent.Bar.BarGui.SG.Size.Size = UDim2.new(0, #Data.Value * Limit.Value ,0, 50)
View all 47 lines...

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...

1Data.Value = "Bla Bla Bla"
2Limit = 2
3 
4script.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 — 5y
0
Do yourself a favor and use more variables man instead of spamming "script.Parent.Parent" Ex_plore 62 — 5y

Answer this question