So i have been trying this for a long time and still can't do it.How do i make it so that when the player is holding a tool THEN they can use UIS (UserInputService).Most of the time i can use the UIS without holding the tool and that is not what i am trying to get.
wait(3)
local UIS = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Holding = false
if script.Parent.Equipped == true then
Holding = true
elseif script.Parent.Equipped == false then
Holding = false
end
UIS.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.R and Holding == true then
print("Key")
local BV = Instance.new("BodyVelocity", Player.Character.HumanoidRootPart)
BV.maxForce = Vector3.new(0, math.huge, 0)
BV.Velocity = Vector3.new(0, 60, 0)
wait(0.5)
BV:Destroy()
end
end)

2 comments
Not sure if this'll work but try script.Parent.Equipped:connect(function() Holding = true end) and the script.Parent.Unequipped:connect(function() Holding = false end)
Doesn't work. I tried it before.