Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Tool doesnt get deactivated when using ButtonR2?

Asked by
jakeovi -1
3 years ago
Edited 3 years ago
local UserInputService = game:GetService("UserInputService")
local Tool = script.Parent
local IsEquiped = false
UserInputService.InputBegan:Connect(function(InputObject)
    if InputObject.KeyCode == Enum.KeyCode.ButtonR2 and IsEquiped then
        Tool:Activate()
    end
end)
UserInputService.InputEnded:Connect(function(InputObject)
    if InputObject.KeyCode == Enum.KeyCode.ButtonR2 and IsEquiped then
    Tool:Deactivate()
    end
end)
Tool.Equipped:Connect(function()
    IsEquiped = true
end)
Tool.Unequipped:Connect(function()
    IsEquiped = false
end)

For people telling that theres r2 to activate, support already, the vr script im using doesnt work activate tools unless i use this script. When I use this script, it works, but it doesnt deactivate my tool.

Answer this question