I am creating a tool, and I don’t want the player to be able to block with the shield while they attack with my tool, because it’ll mess with the animations.
tool script:

Client Event Script:
Block Script:

How do I disable UserInputService for a player?
1 Like
You can’t disable UserInputService
. What I’d do is add a bool attribute on the sword (or weapon the player attacks with) called “Attacking”, and everytime the player attacks set that attribute to true. Then, with the shield, before blocking check if that attribute is true (:GetAttribute()), and if it is, don’t allow the player to block.
4 Likes
but the shield can be used even when the tool is unequipped. i welded it to the player
What do you mean? Nothing will change if you welded it or not. Just check if the player is attacking like I told you to do and you should be fine.
1 Like
ill try do it, but it sounds confusing to me
Can it be done with the userinputservice script?
heres my code

I fixed the script, but it still doesn’t work. The value of the attribute wont change
I changed it to a value instead of an attribute, but it just completely ignores if its value is true or not
1 Like
Alright first of all a couple things I’d edit are:
- Instead of doing
if Attacking.Value == true then return end
just check if Attacking.Value is false and if it is then attack;
- You’re doing checks on the client. You should switch the debounces from the client to the server in order to avoid really easy exploits to remove debounces.
Also the print("Player is attacking etcetc")
won’t work since you’re returning the function before it. Try adding a print(Attacking.Value)
and see if it’s true. Weird because everything seems alright there.
1 Like
i got it to work a bit now,but it only works when the tool is equipped

works again
when its not equipped and the player press e, the script will not work at all
Maybe it’s because you’re checking if the Baton is equipped?
Cause you checked:
local Tool = Player.Character:FindFirstChild("Baton")
if Tool then
-- etc
end
Also if possible next time send a text code not a picture so I can quote the parts I believe you should change.