sigh*,i’ve been trying to make this stupid property thingy for hours now.
the “goal” was to have some global variables set to nil and when the player typed something
they would change value to what the player wrote.
BUT ofcourse One cannot be perfect and it says nil when i print the value right after i assigned it.
normally you would think OK, and just fix it.
BUT I used the EXACT code i used for my number generator(just a random thing i made because i was bored)
and when i used my number generator IT WORKED.
script number generator so you can compare:
script.Parent.FocusLost:Connect(function(enter,obj)
if enter then
local Numbers = require(game.ReplicatedStorage.Numbers)
local Argument = tonumber(script.Parent.Text)
Numbers.AmountOfNumbers = Argument
else
script.Parent.Text = "Error: Press Enter"
end
end)
AAANNNNd the script for the “thing”:
GUI.HealthAmount.FocusLost:Connect(function(enter)
if enter then
local Module = require(script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Scripts.NPC_INFO)
local Arg = tonumber(script.Parent.Text)
Module.Health = Arg
print(Arg)--ITS NIL
print(Module.Health)--Nil for some reason
end
end)
Here is a part of the script that DOES work so you can compare more and see that they are EXACT COPIES of each other(except for some prints):
GUI.Classname.FocusLost:Connect(function(enter)
if enter then
local Module = require(script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Scripts.NPC_INFO)
local Arg = script.Parent.Text
Module.Class = Arg
print(Module.Class)
else
script.Parent.Text = "Press Enter"
end
end)
PS: don’t look at the Parentparentparentparen… i am planning to change where im storing the script once i get this to work.
this is so annoying and the problem isn’t because it’s in a local script, because my number generator script is also in a localscript.