in one script i have
_G.valcoin = 0
script.Parent.Text = _G.valcoin
and in another i have
function onTouched(hit) _G.valcoin += 1 end script.Parent.Touched:connect(onTouched)
but it does not seem to add any number to valcoin? please help.
in one script i have
_G.valcoin = 0
script.Parent.Text = _G.valcoin
and in another i have
function onTouched(hit) _G.valcoin += 1 end script.Parent.Touched:connect(onTouched)
but it does not seem to add any number to valcoin? please help.
First of all, you should provide code in the Code block, apart from not making function local (recommended) and using :Connect instead of deprecated :connect your problem may be that one script is normal and another one is local (because you set the text of some instance in it) and they don't share same global valuables. Please provide more information on kinds of scripts, errors and put the scripts in the Code block.
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
This is way too confusing, try to put your code in an lua code block, and what is "_G"?
Also, can you say what the scripts are? Is one a localscript or an script? Also, format your code.
_G is global variable