Hello! I have a game that allows the player to shine a flashlight by holding down RMB(RightMouseButton) But I can't seem to find the correct use for it in UIS. Here's the script that I have: (its local)
local uis = game:GetService("UserInputService") local holdingRMB = false uis.InputBegan:Connect(function(inputObject) if inputObject.KeyCode == Enum.KeyCode.??? then holdingRMB = true end end)
Any working answer is appreciated.
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local holdingRMB = false mouse.Button2Down:Connect(function() holdingRMB = true end) mouse.Button2Up:Connect(function() holdingRMB = false end) while true do if holdingRMB then --Path to flashlights light = true else --Path to flashlights light = false end wait() end