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

storing values safely in scripts?

Asked by 4 years ago

I've been playing around with int values to store how much "sand" there is in a sandpile or container, but I was storing the values inside the models in the workspace and from what I read it is not a good way to do it. so is this code better or is it not safe enough when the script is under the model in the workspace?


local Material = script.Parent.Material local value = 0 Material.Parent.CollisionDetector.Touched:Connect(function(hit) if hit.Name == "DropOFF" then Material.Transparency = 0 value = value + 1 game:GetService("Debris"):AddItem(hit,1) print(value) end end)
0
Should be safe either way, but this is probably preferred over using values Optikk 499 — 4y

Answer this question