Hi I want to use the weapons kit from the developer website, however once i have installed them into my game the mouse disappears and the camera is locked which is great for gameplay but i would like to be able to enable the mouse at certain points to use Gui's.
anyone know how to do this?
I have looked at the scripting within the pack and i think it would be something to do with the shouldercam script as there is a part which says
-- Hide mouse and lock to center if applicable if self.mouseLocked and not GuiService:GetEmotesMenuOpen() then UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter UserInputService.MouseIconEnabled = false else UserInputService.MouseBehavior = Enum.MouseBehavior.Default UserInputService.MouseIconEnabled = true end
is there a way to enable the mouse to perhaps a key being held?
Yeah sure, you can undo the mouse if a key is pressed using UserInputService. Actually, the script uses UserInputService itself.
Read about it here: [https://developer.roblox.com/en-us/api-reference/class/UserInputService]
Anyways, let me show you how you would do this.
Let’s say if you’re holding down the key Q, the mouse would be unlocked. Make a new LocalScript in the pack and put this:
local UIS = game:GetService(“UserInputService”) -- Gets the UserInputService while wait() do -- loop this if UIS:IsKeyDown(Enum.KeyCode.Q) == true then -- If Q is being held down then UIS.MouseBehavior = Enum.MouseBehavior.Default UIS.MouseIconEnabled = true -- Fix mouse else UIS.MouseBehavior = Enum.MouseBehavior.LockCenter UIS.MouseIconEnabled = false -- Revert mouse back to normal end end
I hope you listened to my comment. However, if you want to stick with the guns (and I see no reason why shouldn't, if these guns have everything you need), I would focus on the following lines:
UserInputService.MouseBehavior = Enum.MouseBehavior.Default UserInputService.MouseIconEnabled = true
So, my solution for this is that whenever there is a GUI use this:
UserInputService.MouseBehavior = Enum.MouseBehavior.Default UserInputService.MouseIconEnabled = true
And when the GUI is gone, use this:
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter UserInputService.MouseIconEnabled = false
Hope this helped!