Also, one more thing to point out.
.Touched only returns part instances not things to do with the terrain. If you want to detect the grass, I suggest you could add a invisible part above the grass and just name it the grass detector.
local GrassDetector = game.Workspace.GrassDetector
local Hit = game.Workspace.Hit
Hit.Shape = "Ball" -- Make sure it is a ball
if touched.Name == "GrassDetector" then
--- do whatever you want
Could you post the line that connects to the initial function?
Oh if the grass is a part then make sure there is only one part that is named “Grass” but the main problem here is that the touched is nil which also tells us that the ball cannot be touched, maybe the ball is not a basepart?
What I want is that only the ball has that function when it is touched by a part called “Grass”
The ball is not basepart and there is only 1 part called grass
The ball has to be a basepart in order for you to connect it with the touched event.
Just make an invisible box around the ball and weld it to the ball so that when the ball moves it won’t disconnect and add the touched event to that invisible box because that invisible box is a basepart which means it can use the touched event.
Was just thinking, this script is in the ball right? Why not use
script.Parent instead of Hit?