Localscript:

User.InputBegan:Connect(function(key)
	if canOpen == true and key.KeyCode == Enum.KeyCode.B then
		plr.PlayerGui.GunShop.Frame.Visible = true
		char.Humanoid.WalkSpeed = 0
		User.MouseIconEnabled = true
	end
	if canOpen == true and key.KeyCode == Enum.KeyCode.P then
		plr.PlayerGui.GunShop.Frame.Visible = false
		char.Humanoid.WalkSpeed = 16
		User.MouseIconEnabled = false
	end
end)

I have tried setting Modal to true, wich didn't work because frames don't have the Modal property, setting player CameraMode to Classic, wich didn't work because you have to zoom out and that would confuse player as they would see the viewmodel and their character behind the gui, and lastly setting UserInputService MouseBehavior to Default, and that didn't work idk why.