Answered by
5 years ago Edited 5 years ago
01 | local part = Instance.new( "Part" ) |
02 | part.Size = Vector 3. new( 5 , 75 , 75 ) |
03 | part.Position = Vector 3. new(- 107.425 , 57.775 , 250.71 ) |
05 | part.Parent = workspace |
07 | local clickdetector = Instance.new( "ClickDetector" ) |
08 | clickdetector.MaxActivationDistance = 30 |
09 | clickdetector.Parent = part |
16 | clickdetector.MouseClick:Connect(onClicked) |
All I did was remove the touch detection code and change it with ClickDetectors. These will allow you to detect if a part was clicked. We create it, set the maximum activation distance and parent it to the part. We make a function that connects to the MouseClick event. While we were talking you also spoke of using the click detector for viewing game pass products and what they do. For that you can insert the localscript into a ScreenGUI and change the visible property of a frame to true.
Hope this helps!