Best way to detect what’s above a part?
So I was think about how selling stuff would work in my game, Farming Simulator. I think I’m going to go for a system where you place a trailer with grain over a part and you go inside, talk to a NPC, and the grain gets unloaded. One thing is though, I’m not sure what the best way to getting what’s above the unloading part. I was thinking something like this.
01 | Part.Touched:connect( function (wheel) |
02 | local Trailer = wheel.Parent |
03 | if Trailer.Name = = = “Trailer” then |
04 | local Filled = Trailer.Filled.Value |
05 | local Grain = Trailer.Grain.Value |
11 | Part.TouchEnded:connect( function () |
*This is all from the top of my head. Some of it might be wrong.
This is the only way to do it that I can think of, but are there any better ways?