I am making a hockey game what I want in this script is when the hockey ball touched a part named "RedGoal" then the hockey ball gets removed.
RG = game.Workspace.RedGoal
BG = game.Workspace.BlueGoal
RS = game.Workspace.RedScore
BS = game.Workspace.BlueScore
script.Parent.Touched:connect(function(part)
if part:ClassName("RedGoal") then
script.Parent:remove()
end
end)

4 comments
The remove function already sets the object's Parent to nil. Just doing so will alter nothing.
The remove function is deprecated.
^ Yeah, @Goul essentially what :remove() does is it doesn't actually delete the instance from the server's memory. When :Destroy() is used, it detaches itself and its children from their respective parents, and effectively deletes it from server memory, freeing up processing capacity.
remove sets the parent to nil, destroy locks it.