-
What do you want to achieve? Keep it simple and clear!
A lightsaber that can block and attack -
What is the issue? Include screenshots / videos if possible!
I need to make the userinput service work. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
It did not work with it.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if script.Parent.Equipped then
local player = script:FindFirstAncestorWhichIsA"Player" or game:GetService"Players":GetPlayerFromCharacter(script.Parent.Parent)
local plrhuman = player.Character:FindFirstChild("Humanoid")
local anim = script.swing1
local setanim = anim:Clone()
setanim.Parent = plrhuman
local animtrack = plrhuman:LoadAnimation(setanim)
animtrack:Play()
end
end
end)
UserInputService.InputBegan:Connect(function(input)
if script.Parent.Equipped then
if input.UserInputType == Enum.UserInputType.MouseButton2 then
print("worked")
end
end
end)
I am not asking for helping with animations and such, just need to know how to make the 2 userinputservice functions work.
Edit: The output has nothing