Ad
Log in to vote
-2

Is this OnClicked right?

Asked by
neoG457 315 Moderation Voter
7 years ago
function onClicked(playerWhoClicked)


local Spiral = Instance.new("Animation")
    Spiral.AnimationId = "http://www.roblox.com/Asset?ID=227009893"
local animTrack = po.Character.Humanoid:LoadAnimation(Spiral)
        animTrack:Play()


        end

        MouseClick:connect(onClicked)

It should play once I click.

0
Is it a Tool or a Gui? woodengop 1134 — 7y
1
Neither its apart of a bigger script in starterpack neoG457 315 — 7y
0
Next time please Put a Better Desc. woodengop 1134 — 7y
0
Well, click detectors are only for base parts. Not for gui's for local scripts or anything. Please show us a screenshot of your explorer tab of something. EzraNehemiah_TF2 3552 — 7y

1 answer

Log in to vote
-1
Answered by 7 years ago

First, you would need to put a ClickDetector in the part you want to click in order for this function to fire. (If it is a GUI, you need a TextButton)

If it isn't a part (Assuming it is a GUI), you need to do this as your connecting line:

TextBox's Location.MouseButton1Click:connect(onClicked)

Otherwise, if it is a part, you need to do this as your connecting line:

ClickDetector's Location.MouseClick:connect(onClicked)

NOTE: Replace (TextBox's Location) and (ClickDetector's Location) with their location (Pretty obvious LOL)

0
Its not a GUI or Part tbh. neoG457 315 — 7y
Ad

Answer this question