Hi, i'm making a tycoon and i'm trying to work out how to detect the touching of two parts when the parts that the droppers dispense touch the collector at the end of the conveyor :/. I have tried .Touched, :GetTouchingParts, and looked endlessly at devforums and scripting helpers. I first tried this:
local Money = script.Parent.Parent.Parent.CashToCollect local Debris = game:GetService("Debris") for i,v in pairs(script.Parent:GetChildren()) do if v.Name == "PartCollector" then v.Touched:connect(function(Part) if Part:FindFirstChild("Money") then Money.Value = Money.Value + Part.Money.Value Debris:AddItem(Part,0.1) end end) end end
There is a IntValue in each part that gets dispensed called 'Money'. The collector is meant to detect the part touching and find the IntValue and add it to another IntValue's Value. I then tried :GetTouchingParts and .Touched but this didn't work. Help please!
You should make it so instead of making the collector give you money when money touches it, you should make it so the money gives you money when it touches the collector. Hope you understand.
EDIT: You put a script inside of the money block and check when it touches the collector.