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

Is this OnClicked right?

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.

4 comments

0

Is it a Tool or a Gui?

1

Neither its apart of a bigger script in starterpack

0

Next time please Put a Better Desc.

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.

1 answer

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)

1 comment

0

Its not a GUI or Part tbh.

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