I'm making an effect on this part as if it were being shatteed:
function onClicked(Player) script.Parent.Crack1.Visible=true wait(0.4) script.Parent.Crack2.Visible=true wait(0.4) script.Parent. Destroy() wait(0.1) Button=script.Parent.Parent.Parent.StarterGui.ScreenGui.Button1 if Button.Text=>0 then Button.Text.+1 end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Im having some trouble with this can you help?
The button is for an Inventory GUI that shows how much of this material has been mined, The Crack 1 and Crack 2 are for an animation to see the block seemingly cracking. Will the button Text work??
The Problem might be your using a regular script instead of a Local script and also you were trying to use ClickDetector with a Gui which you can't do because you can Only Use ClickDetector's when the script involve a Part that you want to click. Please forgive my lack of explanation it just that I'm quite new to Scripting.
function onClicked(Player) script.Parent.Crack1.Visible=true wait(0.4) script.Parent.Crack2.Visible=true wait(0.4) script.Parent. Destroy() wait(0.1) Button=script.Parent.Parent.Parent.StarterGui.ScreenGui.Button1 if Button.Text=>0 then Button.Text.+1 end script.Parent.MouseButton1Click:connect(onClicked)