Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make clickable part?

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??

1 answer

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)

3 comments

0

Please accept my answer if I helped with your problem :)

0

You missed an error on line 10.

0

Thanks Perci1 I didn't see that.

This discussion is preserved as it was. New answers, comments, and votes are closed.