Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make clickable part?

Asked by 10 years ago

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

Log in to vote
2
Answered by 10 years ago

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)
0
Please accept my answer if I helped with your problem :) UserOnly20Characters 890 — 10y
0
You missed an error on line 10. Perci1 4988 — 10y
0
Thanks Perci1 I didn't see that. UserOnly20Characters 890 — 10y
Ad

Answer this question