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

Make this run when it is clicked?

I want this to run when it is clicked rather then when you enter a game.

local increment = .05

function RunAnimation(p)
	local p = p or script.Parent
	local rightframe = p.CFrame + p.CFrame:vectorToWorldSpace( Vector3.new(1,0,0) * p.Size.X/2 )
	for i = 0, math.pi/2, .05 do
		wait()
		local newframe = rightframe * (CFrame.Angles(0, -i, 0) * 
CFrame.new(p.Size.X/-2,0,0))
		p.CFrame = newframe
	end
end

RunAnimation()

3 comments

0

Be more specific and what exactly are you trying to do?

0

I am trying to make the function run when it is click. I have tried brick.ClickDetector.MouseClick:connect(RunAnimation) with brick already defined. It doesn't work.

0

You can't declare a variable with a conditional operator for local p

1 answer

ok this isn't a answer but idk what i'd do for that.. xDDDD Maybe run a quick test? X3 (Script Test)

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