It is so simple which means the answer is probably obvious.
Here is my script.
script.Parent.Touched:connect(function(hit) if hit.Name == "Copper" then workspace.Tycoon.Collector.Cash.Value = workspace.Tycoon.Collector.Cash.Value + 2 end end)
This is my error: Collector is not a valid member of Model
I realize the code can be shortened. I had it shortened with a variable but I removed it to see if it was causing a problem.
I checked the spelling, model location, made sure everything was right but it is still giving an error. Even when I use code completion it gives the same error. This has me really confused...
Using "WaitForChild" will wait until something is there. If it isn't there, then it will not continue.
local collector=workspace.Tycoon:WaitForChild("Collector")--This might work. print("It's there!") script.Parent.Touched:connect(function(hit) if hit.Name=="Copper" then print'Found "Copper"'--Don't worry, prints can be written out like that. collector.Cash.Value=collector.Cash.Value+2 print'Done!' --Just to make sure the function is finished. end end)