So in one script in a model, I set a value: health = 10 So then in a different script I want to change that for something and I try to get to the value like this: script.Parent.Parent.Script.health It didn't work. How do I get to values in other scripts?
I would store them as int values or number values.
at the top of script do
a script in workspace named 'healthScript'
local health = Instance.new("NumberValue",script) health.Name = "health" health.Value = 10 health.Changed:connect(function () print(health.Value) end)
a script in workspace
workspace.healthScript.health.Value = 5
This should print 5
Update: was half asleep and workspace is a bad idea to store scripts however thanks for adark pointing it out!
** Just a tip, it is bad practice to put Scripts in the Workspace. It's much safer to put them in the ServerScriptService. ** ~ adark