Click to attack script doesn't work, for some reason it just stops?
Asked by
4 years ago Edited 4 years ago
Hello! I was trying to create a click to attack script which plays an animation on click. When I made the script, the only thing that didn't seem to work was the function at the bottom of the script. I took it from a tutorial, so I have no idea at all how to fix it. By the way, I'm not using a tool. I'm using an accessory with a union that has an attachment in ServerStorage.
01 | userInputService = game:GetService( "UserInputService" ) |
03 | storage = game:GetService( "ServerStorage" ) |
05 | scissor = storage.ScissorBlade |
07 | plr = script.Parent.Parent.Character |
09 | animation = plr.Humanoid:LoadAnimation(scissor.Animation) |
12 | userInputService.InputBegan:Connect( function (input, gameProcessedEvent) |
13 | if input.UserInputType = = Enum.UserInputType.MouseButton 1 then |
15 | plr.Humanoid.WalkSpeed = 0 |
Those print("1")s were tests to see if the problem was from any of the variables; all 1s printed successfully. Also, "Attack" did not print.
If anyone knows how to fix or make this script better, please write an answer, and thank you!