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

Sword swing different every swing script help?

I'm not really a scripter but an animator, but I have a problem. I animated 3 type of sword swings and i want to place them in order like a combo every time you click. Anyone know how to script that?

1 answer

Yes. You can user the UserInputService by doing this :

local UIS = game:GetService("UserInputService")
chain = 0

Then you can make it so if the player clicks the left mouse it will play whatever you tell it to. Here's an example :

UIS.InputBegan:connect(function(input, gameProcessedEvent)
	if not gameProcessedEvent then
		if input.UserInputType == Enum.UserInputType.MouseButton1 and chain == 0 then
chain = 1
--Do your stuff here--
else
if input.UserInputType == Enum.UserInputType.MouseButton1 and chain == 1 then
chain = 2
--Do your stuff here
			print('Left Mouse Button Press')
			--insert code here
		end
	end
end
end)

And so on.

If you want a better example, please comment

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